testdb

package
v0.3.0 Latest Latest
Warning

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

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

Documentation

Overview

Package testdb gives integration tests a Postgres database of their own.

Each test gets a fresh schema, so tests run in parallel and leave nothing behind. The database comes from HOPPER_TEST_DATABASE_URL; without it, integration tests are skipped.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Driver added in v0.3.0

func Driver(pool *pgxpool.Pool) *hopperpgx.Driver

Driver binds the driver to the isolated schema created by EmptyPool.

func EmptyPool

func EmptyPool(t testing.TB, maxConns int32) *pgxpool.Pool

EmptyPool is like Pool but leaves the schema empty, for migration tests. maxConns of 0 uses the pgxpool default.

func Pool

func Pool(t testing.TB) *pgxpool.Pool

Pool returns a pool whose search_path is a schema created for this test, with hopper's schema installed. The schema is dropped when the test ends.

func URL

func URL(t testing.TB) string

URL returns HOPPER_TEST_DATABASE_URL or skips the test.

Types

This section is empty.

Jump to

Keyboard shortcuts

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