Help us shape the future of Go! Take the 2026 Go Developer Survey

testpg

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package testpg provides Postgres-backed test isolation for mlfs. Each call to DB creates a fresh, uniquely-named schema (pinned via the connection's search_path) and drops it on t.Cleanup, so gated integration tests no longer share one database behind a TRUNCATE. The upshot: `go test ./...` is parallel-safe and the old `-p 1` requirement is gone.

Index

Constants

View Source
const EnvVar = "MLFS_TEST_DATABASE_URL"

EnvVar names the pgx DSN that enables the gated tests.

Variables

This section is empty.

Functions

func DB

func DB(t testing.TB) *sql.DB

DB returns a *sql.DB whose connections are scoped to a fresh, private schema. It skips the test when EnvVar is unset. The schema and everything in it is dropped on t.Cleanup, giving each caller an isolated namespace with no shared TRUNCATE — so packages (and tests) can run concurrently.

Types

This section is empty.

Jump to

Keyboard shortcuts

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