Documentation
¶
Index ¶
- func MinimalConfig() *config.APIConfigSpec
- func NewTestDB(ctx context.Context) (*pgxpool.Pool, func(), error)
- func NewTestRouter(pool *pgxpool.Pool, cfg *config.APIConfigSpec) *gin.Engine
- func SeedPauses(ctx context.Context, db *pgxpool.Pool, cfg *config.APIConfigSpec) error
- func SeedScoring(ctx context.Context, db *pgxpool.Pool, cfg *config.APIConfigSpec) error
- func SeedUsers(ctx context.Context, db *pgxpool.Pool, cfg *config.APIConfigSpec) error
- func SetupConfig(cfg *config.APIConfigSpec)
- func SkipDBTests(err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MinimalConfig ¶
func MinimalConfig() *config.APIConfigSpec
MinimalConfig returns a minimal APIConfigSpec for tests: 2 teams, 1 box, 2 services.
func NewTestDB ¶
NewTestDB starts a postgres:18.4 container, applies the schema, and returns a pool and cleanup func. Returns an error (rather than panicking) if Docker is unavailable or broken.
func NewTestRouter ¶
NewTestRouter builds a Gin engine using the real application routes, with DB and config injected directly (no globals required).
func SeedPauses ¶ added in v0.0.56
SeedPauses seeds pause_states with the config's starting state. Score writes read this table, so a DB-backed test that records a score must call this first.
func SeedScoring ¶
SeedScoring inserts zero-count rows into final_scores. Requires SetupConfig to have been called.
func SeedUsers ¶
SeedUsers inserts default users into scoring_users. Requires SetupConfig to have been called.
func SetupConfig ¶
func SetupConfig(cfg *config.APIConfigSpec)
SetupConfig sets config.TeamRange from cfg without calling config.SetConfig.
func SkipDBTests ¶
func SkipDBTests(err error)
SkipDBTests emits a proper go test SKIP record and exits 0 when Docker or the DB is unavailable. Call in TestMain when NewTestDB returns an error. Output is visible with -v; without -v go test shows "ok ... [no tests to run]" (same behavior as any t.Skip call in a TestMain-only binary).
Types ¶
This section is empty.