testutil

package
v0.0.0-...-b3d25bc Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetHostPort

func GetHostPort() (string, int)

GetHostPort returns the container's host and port.

func MustStartPostgresContainer

func MustStartPostgresContainer()

MustStartPostgresContainer starts the test container and initializes testDB. Call from TestMain before m.Run().

func TeardownPostgresContainer

func TeardownPostgresContainer()

TeardownPostgresContainer stops the container. Call from TestMain after m.Run().

Types

type TestDB

type TestDB struct {
	DB *sql.DB
}

TestDB holds a test database connection.

func SetupTestDB

func SetupTestDB(t *testing.T) *TestDB

SetupTestDB returns the shared test database, cleaning tables for isolation.

func (*TestDB) CleanTables

func (tdb *TestDB) CleanTables(t *testing.T)

CleanTables truncates all test tables.

Jump to

Keyboard shortcuts

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