temp-postgres
Easy temporary postgresql instance for unit tests.
Use the [TempPostgres
] struct to get a [tokio_postgres::Client
] that is connected to a temporary postgres instance.
All state of the spawned postgres instance is stored in a temporary directory, which will be cleaned up automatically (unless disabled).
On Unix platforms, the client is connected over a Unix socket. Windows support is planned by picking a free TCP port on the loopback adapter.
Example
See the example in the repository for a more detailed example using assert2
.
use TempPostgres;
let postgres = new.await?;
println!;
let client = postgres.client.await?;
client.execute.await?;
License: MIT