Documentation
¶
Overview ¶
Package testdb starts ephemeral Postgres/Redis containers for integration tests. Each helper accepts an env-var name; when that variable is set it is returned verbatim (caller-supplied infrastructure wins). Otherwise a testcontainers-go container is started and registered for cleanup.
If neither path produces a usable backend (e.g. Docker is unavailable), the test is skipped with a clear message — the same outcome as the legacy "skip when env var unset" pattern, but with automatic local containers when Docker is running and CI doesn't need to set env vars.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Postgres ¶
Postgres returns a Postgres DSN. Resolution order:
- If envVar is non-empty and the env var is set, return its value.
- Otherwise start an ephemeral postgres testcontainer and register cleanup. The DSN points at the new container.
- If the container can't start (e.g. Docker unavailable), t.Skip.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.