sqltest

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 24 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 IdentityPaging

func IdentityPaging(t *testing.T, s *sqlcommon.Store)

IdentityPaging exercises small first/late pages over a larger data set and retains the query plan for the name continuation used by ListSummaries.

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 RemoteCachePersistence

func RemoteCachePersistence(t *testing.T, s *sqlcommon.Store, reopen func() *sqlcommon.Store)

RemoteCachePersistence exercises upgrading real pre-cache repositories and reopening the backend with completed and in-flight retrieval records.

func ReplayCrash

func ReplayCrash(t *testing.T, s *sqlcommon.Store, env []string)

ReplayCrash kills a separate process after its transactional mutation but before its receipt commits. Both the effect and receipt must roll back.

func ReplayCrashChild

func ReplayCrashChild(t *testing.T, s *sqlcommon.Store)

ReplayCrashChild is called only by each backend's subprocess test helper.

func RepositoryHeaders

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

RepositoryHeaders proves sealing and lifecycle behavior through both SQL backends and exercises the real configuration merge. Resolver revision behavior is covered by remote.TestAccResolverSealedCredentialsAndRotation; importing that service here would cycle through auth's SQL-backed seed tests.

func RepositoryHeadersMigration

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

RepositoryHeadersMigration upgrades a real version-15 database, preserving legacy values and unrelated document fields while eliminating live plaintext.

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