Skip to main content

Module test_db

Module test_db 

Source
Expand description

Destructive helpers for creating isolated PostgreSQL test databases.

These APIs create, terminate connections to, and drop databases. They are intended only for test harnesses whose prefix is exclusively owned by the caller.

Structs§

TestDatabaseGuard
Owns a test database and removes it promptly when dropped.

Constants§

DEFAULT_STALE_TEST_DATABASE_AGE
Default minimum age of a disconnected test database before it is reaped.

Functions§

create_test_database
Creates an isolated database and a guard that drops it on normal exit.
reap_stale_test_databases
Drops disconnected databases in the generated naming format that are at least max_age old, returning only names this call actually dropped.