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

sqltest

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Overview

Package sqltest provides PostgreSQL for the store contract runs. It starts one container per test binary with testcontainers-go and skips the calling test where Docker cannot run Linux containers (decision 0015), so the suite runs everywhere and the PostgreSQL half runs in the Linux CI jobs. Set ARTIFACTWEAVE_TEST_POSTGRES_DSN to use an existing server instead.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PostgresDSN

func PostgresDSN(t *testing.T) string

PostgresDSN returns a DSN for the PostgreSQL server shared by the test binary, or skips t when there is none and Docker cannot run Linux containers.

func Reset

func Reset(t *testing.T, db *sql.DB, d sqlcommon.Dialect)

Reset rolls every migration back and applies them again, leaving an empty schema. Running it before each contract test also exercises every down migration on every run.

func Rotation

func Rotation(t *testing.T, open Opener)

Rotation is decision 0017's rotation test over a populated store: every sealed column gets a value under version 1, Reseal under versions 1 and 2 moves all of them to version 2, a second run changes nothing, and a store holding only version 2 reads every value back.

Types

type Opener

type Opener func(t *testing.T, keys *crypt.Keyring) *sqlcommon.Store

Opener opens the same database each call with the given keyring (nil for none).

Jump to

Keyboard shortcuts

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