pgtest

package
v0.3.0 Latest Latest
Warning

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

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

Documentation

Overview

Package pgtest opens throwaway Postgres schemas for integration tests.

Index

Constants

View Source
const TestDSNEnv = "HALO_TEST_PG_DSN"

TestDSNEnv names the variable holding a Postgres URL for integration tests; they skip when it is unset.

Variables

This section is empty.

Functions

func OpenTest

func OpenTest(t testing.TB, schema ...string) (*pgstore.DB, string)

OpenTest returns a migrated DB in a fresh schema (see Schema). Each call opens its own pool, so two calls on one schema model two replicas: pass the first call's schema to share it.

func Schema

func Schema(t testing.TB) string

Schema creates an empty schema in the HALO_TEST_PG_DSN database (dropped when t ends) and returns its name, or skips t when the variable is unset.

func URL

func URL(schema string) string

URL is the HALO_TEST_PG_DSN database URL with schema first on the search path.

Types

This section is empty.

Jump to

Keyboard shortcuts

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