Documentation
¶
Overview ¶
Package dbtest gives tests an isolated, fully-migrated PostgreSQL database with no external server to run. It starts one embedded server per test binary, migrates a template once, and hands each test a fresh database cloned from that template — real commits and all, so concurrency behaviour (advisory locks, transactions) is exercised exactly as in production.
Use it from a test package like:
func TestMain(m *testing.M) { dbtest.Main(m) }
func TestThing(t *testing.T) {
db := dbtest.New(t)
// ... db is a clean, migrated *pgxpool.Pool; dropped when the test ends
}
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.