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

testharness

package
v0.3.6 Latest Latest
Warning

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

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

Documentation

Overview

Package testharness provides a Postgres test harness for migration driver tests. Each call to New() creates an isolated PostgreSQL schema so tests don't pollute each other's state.

Backend selection:

  1. ProvidedDSN — if WORKFLOW_MIGRATE_TEST_DSN env var is set.
  2. EmbeddedPostgres — Fergus Strange's pure-Go embedded Postgres (default).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Harness

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

Harness wraps a running Postgres instance with an isolated schema.

func New

func New() (*Harness, error)

New creates and starts a new Postgres harness with an isolated schema. The caller must defer h.Close(t) to clean up the schema and stop the server.

func (*Harness) Close

func (h *Harness) Close(t *testing.T)

Close drops the isolated schema and stops the embedded Postgres server if any.

func (*Harness) DSN

func (h *Harness) DSN() string

DSN returns the PostgreSQL connection string for this harness. The DSN includes search_path=<schema> for isolation.

Jump to

Keyboard shortcuts

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