Documentation
¶
Overview ¶
Package dbtest provides a parallel-safe test database harness. Each caller gets a freshly cloned database from a template that has all migrations applied.
Usage:
func TestSomething(t *testing.T) {
pool := dbtest.NewTestDB(t)
// pool is a *pgxpool.Pool against a freshly cloned DB.
}
The harness reads SHITHUB_TEST_DATABASE_URL for the bootstrap connection (used to CREATE/DROP databases). Tests are skipped if the env var is not set, so unit tests stay green on machines without Postgres.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.