testdb

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: MIT Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package testdb connects integration tests to PostgreSQL.

Tests that need a database call Pool. They are skipped when the TASKMILL_TEST_DATABASE_URL environment variable is unset; `make test` sets it to the database that `make db` starts. Each test gets its own schema, so tests can run in parallel and leave nothing behind.

Index

Constants

View Source
const EnvURL = "TASKMILL_TEST_DATABASE_URL"

EnvURL names the environment variable that holds the test database URL.

Variables

This section is empty.

Functions

func Pool

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

Pool returns a pool of up to 8 connections to the test database, closed when the test ends.

func PoolSize

func PoolSize(tb testing.TB, conns int32) *pgxpool.Pool

PoolSize is Pool with a given number of connections, for tests that run many operations at once.

func Schema

func Schema(tb testing.TB, pool *pgxpool.Pool) string

Schema returns a fresh schema name, and drops that schema when the test ends.

func URL

func URL(tb testing.TB) string

URL returns the test database URL, or skips the test if none is set.

Types

This section is empty.

Jump to

Keyboard shortcuts

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