testhelpers

package
v0.0.0-...-f7cff1c Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: OSL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PostgresContainer

type PostgresContainer struct {
	Container testcontainers.Container
	Config    *database.Config
	DB        *database.Connection
}

PostgresContainer wraps a testcontainers PostgreSQL instance

func SetupPostgresContainer

func SetupPostgresContainer(ctx context.Context, t *testing.T) (*PostgresContainer, error)

SetupPostgresContainer creates and starts a PostgreSQL test container

func (*PostgresContainer) Cleanup

func (c *PostgresContainer) Cleanup(ctx context.Context) error

Cleanup terminates the test container and closes database connection

func (*PostgresContainer) ResetDatabase

func (c *PostgresContainer) ResetDatabase(ctx context.Context) error

ResetDatabase drops and recreates all tables (useful for clean state)

func (*PostgresContainer) TruncateTables

func (c *PostgresContainer) TruncateTables(ctx context.Context, tables ...string) error

TruncateTables removes all data from tables (useful between tests)

Jump to

Keyboard shortcuts

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