dbtest

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 29, 2026 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Overview

Package dbtest provides a throwaway PostgreSQL container for integration tests. It is imported only from *_test.go files (via each package's TestMain), so its heavy testcontainers/docker dependencies never end up in the noisia binary.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunMain

func RunMain(m *testing.M) int

RunMain starts a throwaway PostgreSQL container, points db.TestConninfo at it, runs the package tests and removes the container afterwards. Each test package calls it from TestMain, so every package gets its own isolated database — which matters because the workloads mutate server-wide state (pg_stat_*, temp files).

Usage in a package's TestMain:

func TestMain(m *testing.M) { os.Exit(dbtest.RunMain(m)) }

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL