pgtest

package
v0.0.0-...-f6d59cb Latest Latest
Warning

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

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

Documentation

Overview

Package pgtest starts PostgreSQL test containers with the production role scripts and migrations applied.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecUntriggered

func ExecUntriggered(ctx context.Context, super *pgx.Conn, sql string, args ...any) error

ExecUntriggered runs sql on the superuser connection super with the tables' triggers off (session_replication_role = replica, superuser only); constraints still apply. Fixtures use it for rows a service could not write as they are, such as an action started or finished long ago (migration 00084 bounds an action's times to the database clock).

func Image

func Image(t testing.TB, name string) string

Image returns a pinned image reference from deploy/compose/versions.env.

func RepoRoot

func RepoRoot() (string, error)

RepoRoot returns the repository root (directory containing go.work).

Types

type Audit

type Audit struct {
	Super, Owner, Writer, Reader string
}

Audit holds the DSNs of every role of database paddock_audit.

func SharedAudit

func SharedAudit(t *testing.T) Audit

SharedAudit starts one migrated paddock_audit database per test binary.

func StartAudit

func StartAudit(t testing.TB) Audit

StartAudit starts PostgreSQL with deploy/compose/postgres/provision-roles.sh and migrates paddock_audit.

type Paddock

type Paddock struct {
	Super, Owner, API, Platform, Relay, Worker, Compiler, EscrowReader, Revocation, Notifier, Backup string
}

Paddock holds the DSNs of every role of database paddock.

func SharedPaddock

func SharedPaddock(t *testing.T) Paddock

SharedPaddock starts one migrated paddock database per test binary; Ryuk removes the container at exit.

func StartPaddock

func StartPaddock(t testing.TB) Paddock

StartPaddock starts PostgreSQL with deploy/compose/postgres/provision-roles.sh and migrates database paddock.

Jump to

Keyboard shortcuts

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