pgtest

package
v0.0.0-...-8647d1c Latest Latest
Warning

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

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

Documentation

Overview

Package pgtest starts throwaway, migrated Postgres containers for integration tests and cmd/eval. Ryuk is off on podman, so nothing reaps containers for us: Main, New and Start's callers always close what they start. Only tests and cmd/eval may link it (make lint-go checks the commands).

Index

Constants

View Source
const Image = "pgvector/pgvector:0.8.7-pg18-trixie@sha256:5895949dfcdf308eb0cd31c950c93c14895c77f33fbedfecf1fa511ab1d4bcd2"

Image is the dev stack's Postgres image; TestImageMatchesCompose keeps the two in sync.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	URL  string
	Pool *pgxpool.Pool
	// contains filtered or unexported fields
}

DB is a running Postgres with every migration applied.

func Start

func Start(ctx context.Context) (*DB, error)

Start runs a Postgres container and applies the migrations. On error nothing is left running.

func (*DB) Close

func (d *DB) Close() error

Close closes the pool and removes the container with its anonymous volumes.

func (*DB) MigrateTo

func (d *DB) MigrateTo(ctx context.Context, version int64) (err error)

MigrateTo moves d's schema up or down to goose version version, so a test can check a migration in both directions.

func (*DB) Stop

func (d *DB) Stop(ctx context.Context) error

Stop stops the container but keeps it for Close, so a test can watch the database go away.

Jump to

Keyboard shortcuts

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