testpg

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package testpg hands tests a private PostgreSQL database each.

MEMSTORE_TEST_PG names an admin DSN on a server with pgvector. Every call creates a database of its own there and drops it when the test ends, so migrations never race across tests (a UNIQUE index creation colliding on its name under `go test ./...` parallelism was the original reason for this) and no test sees another's default user, tokens, or facts. Without the variable the test is skipped, which is what a laptop with no Postgres should see; CI sets it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Available

func Available() bool

Available reports whether MEMSTORE_TEST_PG is set, for callers that want to decide something before skipping.

func DSN

func DSN(t testing.TB) string

DSN creates a fresh database and returns a DSN targeting it. The database is dropped with FORCE on cleanup, best effort.

func Pool

func Pool(t testing.TB) *pgxpool.Pool

Pool creates a fresh database and returns a pool connected to it. The pool is closed and the database dropped on cleanup.

Types

This section is empty.

Jump to

Keyboard shortcuts

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