dbtest

package
v1.53.11 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package dbtest runs a test on both engines the engine's shared database can be on.

SQLite always runs. PostgreSQL runs when TASKS_TEST_SQL_DSN names a server whose role may create databases (cloud's scripts/postgres.sh starts one, and exports it as CLOUD_TEST_SQL_DSN); without it the postgres subtest is a visible skip.

The body is handed a function that opens a handle on the test's database. Each call is a pool of its own onto the same rows, which is what a replica is: two pods do not share a pool, they share a server.

Index

Constants

View Source
const Env = "TASKS_TEST_SQL_DSN"

Env names the PostgreSQL server the postgres leg runs on.

Variables

This section is empty.

Functions

func Engines

func Engines(t *testing.T, body func(t *testing.T, open Open))

Engines runs body once per engine, each as a subtest, on a database of its own.

Types

type Open

type Open func() *sql.DB

Open opens a handle on the database of the test, closed when the test ends.

Jump to

Keyboard shortcuts

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