Documentation
¶
Overview ¶
Package testutils provides a minimal set of helpers used by the outbox test suite.
Index ¶
- func NewTestDB(dbConnStr, testName string, maxPool, maxIdle int) (*sqlx.DB, func(), error)
- func NewTestLogger(t *testing.T) zerolog.Logger
- func NoGoroutineLeak(t *testing.T)
- func SeedTables(t *testing.T, db *sql.DB, sqlFS fs.FS, seedScriptFileName string)
- func SetupMockDB(t *testing.T) (*sqlx.DB, sqlmock.Sqlmock, func())
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewTestDB ¶
NewTestDB creates an isolated test database by cloning the template database referenced in dbConnStr. The new database is named "{template}_{testName}". The returned cleanup func drops it.
Intended for integration tests; expects a running Postgres with the outbox migrations already applied to the template DB.
func NewTestLogger ¶
NewTestLogger returns a console-formatted zerolog logger at Debug level.
func NoGoroutineLeak ¶
NoGoroutineLeak ensures the calling test does not leave goroutines running after it returns. Used via:
defer testutils.NoGoroutineLeak(t)
func SeedTables ¶
SeedTables executes a SQL file from the provided FS against the DB. Pass an empty seedScriptFileName to skip seeding.
Types ¶
This section is empty.