conformance

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package conformance provides a test suite that every MigrationDriver must pass. Third-party driver authors import this package and call Suite.Run(t, driver) to verify their implementation against the standard behavioural matrix.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CaseResult

type CaseResult struct {
	Name string
	Err  error
}

CaseResult holds the outcome of a single conformance case.

type Runner

type Runner struct {
	// contains filtered or unexported fields
}

Runner executes the conformance suite without requiring *testing.T. It is used by the `migrate test` CLI subcommand and can be embedded in integration-test harnesses that need pass/fail results as Go values.

func NewRunner

func NewRunner(dsn, dir string, d interfaces.MigrationDriver) *Runner

NewRunner creates a Runner for the given driver, DSN, and migration directory.

func (*Runner) Run

func (r *Runner) Run(ctx context.Context) []CaseResult

Run executes the full-cycle and checkpoint conformance cases sequentially. Each case resets the database state (via repeated Down calls) before running.

func (*Runner) Setup

func (r *Runner) Setup(ctx context.Context) error

Setup applies all pending migrations. Called by `migrate test --keep-alive` to prepare the database for external integration tests and print the DSN.

type Suite

type Suite struct {
	// DSN is the PostgreSQL connection string to use.
	DSN string
	// contains filtered or unexported fields
}

Suite runs the conformance test matrix against a given MigrationDriver.

func NewSuite

func NewSuite(dsn string) *Suite

NewSuite creates a Suite using the provided DSN.

func (*Suite) Run

func (s *Suite) Run(t *testing.T, d interfaces.MigrationDriver)

Run executes all conformance cases against the given driver. The corpus format is selected based on the driver name (goose uses combined SQL files with -- +goose Up/Down annotations; others use paired .up.sql/.down.sql files).

Jump to

Keyboard shortcuts

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