| Crates.io | tempdb_cockroach |
| lib.rs | tempdb_cockroach |
| version | 1.0.9 |
| created_at | 2019-09-07 18:00:25.484507+00 |
| updated_at | 2019-09-08 11:37:41.866799+00 |
| description | Temporary databases for unit testing |
| homepage | |
| repository | https://github.com/calder/rust-tempdb |
| max_upload_size | |
| id | 163030 |
| size | 8,083 |
Temporary CockroachDB databases for unit testing.
Add the following to your Cargo.toml:
[dev-dependencies]
tempdb_cockroach = ""
Install libpq-dev (required by the postgres crate):
sudo apt install libpq-dev
Install cockroach if you haven't already:
wget -qO- https://binaries.cockroachdb.com/cockroach-latest.linux-amd64.tgz | tar -xvz
sudo cp cockroach-*.linux-amd64/cockroach /usr/local/bin
extern crate tempdb_cockroach;
use tempdb_cockroach::TempCockroach;
#[test]
fn test() {
let db = TempCockroach::new().expect("Failed to create DB");
println!("Connection string: {}", db.url());
// Cockroach process and data are cleaned up when db goes out of scope.
}