Documentation
¶
Overview ¶
Package testdb gives integration tests a fresh, migrated Postgres database.
The first call starts Postgres 18 with testcontainers (or uses the server in REPUTECAST_TEST_DATABASE_URL, which is faster locally: point it at the docker compose Postgres), migrates a template database once, and then clones it per test with CREATE DATABASE … TEMPLATE, which takes a few ms. Each run first drops what finished runs left behind (see sweep).
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Image = "postgres:18-alpine"
Image is the Postgres image used when no server URL is configured.
Functions ¶
func New ¶
New returns a pool connected to a fresh database cloned from the migrated template. The database is dropped when the test ends.
func NewFrom ¶
NewFrom is New cloning template, a database made by Template ("" for the migrated template).
Types ¶
This section is empty.