Repository navigation
v2.0.0-alpha.2
Pre-release
Pre-release
embedded-postgres v2 alpha
Run real PostgreSQL in Go tests with automatic cleanup, or use the CLI with any
test runner. v2 requires Go 1.26+ and has no third-party production Go dependencies.
Start here
- Go tests: add
github.com/fergusstrange/embedded-postgres/v2at this release's
tag, then calleptest.Start(t). PostgreSQL and the matching supervisor download
automatically on first use and are cached for later tests. - Other test runners: install the CLI and run
embedded-postgres exec -- YOUR_TEST_COMMAND.
It suppliesDATABASE_URL, runs your tests and closes PostgreSQL afterward. - Upgrading from v1: follow the migration guide.
This is a major-version migration; use the/v2import path.
The quick start and
CLI guide
cover installation and configuration.
Included in v2
- PostgreSQL 15–18; Linux, macOS and Windows on AMD64 and ARM64. Windows ARM64 uses
x64 PostgreSQL under emulation. - Isolated test instances, available ports, a shared verified binary cache and
explicit persistent-data storage. Caller-supplied data is never automatically erased. - Independent supervision for cleanup after owner exit or panic, and explicit
Unix UID/GID support for tests running as root. - Custom binary providers and lifecycle hooks for migrations and extensions.
- CLI foreground, command-scoped and background modes, plus protocol 1 for wrappers.
PostgreSQL's native runtime requirements
still apply. Source checkouts and local module replacements need an explicitly
selected supervisor. v2 remains a prerelease while downstream migrations are validated.