testdb

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const IntegrationEnv = "PGMESH_INTEGRATION"

Variables

This section is empty.

Functions

func Enabled

func Enabled() bool

Enabled reports whether Docker-backed integration tests were requested.

func OpenPool

func OpenPool(ctx context.Context, dsn string) (*pgxpool.Pool, error)

OpenPool creates and verifies a PostgreSQL pool for an integration endpoint.

func ResolveDSN

func ResolveDSN(dsnOverride, portOverride string, defaultPort int) (string, error)

ResolveDSN gives a full DSN precedence over a validated port override.

func Rollback

func Rollback(t testing.TB, tx pgx.Tx)

Rollback closes a test transaction and ignores the expected post-commit ErrTxClosed result.

Types

type Endpoint

type Endpoint struct {
	Name        string
	DSNEnv      string
	PortEnv     string
	DefaultPort int
}

Endpoint describes one PostgreSQL database used by the integration topology.

func DefaultEndpoints

func DefaultEndpoints() []Endpoint

DefaultEndpoints returns the five isolated databases in the test topology.

func PrimaryEndpoint

func PrimaryEndpoint() Endpoint

PrimaryEndpoint returns the shard-zero primary used by single-database tests.

func (Endpoint) DSN

func (e Endpoint) DSN() (string, error)

DSN resolves the endpoint's full-DSN or port environment override.

Jump to

Keyboard shortcuts

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