Documentation
¶
Overview ¶
Package testutil provides generic, domain-agnostic test helpers for services built on go-foundation: in-memory SQLite databases, ready-made test configurations, and (behind the "integration" build tag) a PostgreSQL testcontainers harness.
Package testutil's PostgreSQL harness logic lives here, deliberately WITHOUT the "integration" build tag, so the branchy setup/reset/skip logic is unit testable with a fake executor and injected seams — no container or live database required. The heavy, testcontainers-backed wiring that drives this logic stays in postgres.go behind the "integration" tag.
Index ¶
Constants ¶
const TestDatabaseURLEnv = "FOUNDATION_TEST_DATABASE_URL"
TestDatabaseURLEnv is the env var that, when set, points the harness at an already-running PostgreSQL instance instead of booting a container.
Variables ¶
This section is empty.
Functions ¶
func NewTestConfig ¶
func NewTestConfig(opts ...ConfigOption) *config.Config
NewTestConfig creates a generic test configuration backed by SQLite. Consuming services can override fields via functional options.
Types ¶
type ConfigOption ¶
ConfigOption is a functional option for configuring test config.
func WithEnvironment ¶
func WithEnvironment(env string) ConfigOption
WithEnvironment sets the environment in test config.
func WithVersion ¶
func WithVersion(version string) ConfigOption
WithVersion sets the version in test config.