storetest

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: Apache-2.0 Imports: 18 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 storetest runs the tests of api's database on a real PostgreSQL with no Docker, as the devcontainer and CI have none: embedded-postgres starts one server for a test binary, when its first test asks for a database, migrates a template database once, and gives each test a database of its own made from it, which is a copy and takes milliseconds (R29; amendment of 2026-11-02 to R05).

A package whose tests use it runs them under its TestMain:

func TestMain(m *testing.M) { os.Exit(storetest.Main(m)) }

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DB

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

DB is a pool on a migrated database of the test's own, closed when the test ends.

func Main

func Main(m *testing.M) int

Main runs the tests and then stops the server, if a test started it, and returns the code the test binary exits with.

func OpenFGAURL added in v0.1.2

func OpenFGAURL(t testing.TB, migrated bool) string

OpenFGAURL is the connection string of a database openfga of the test's own: migrated, with the store api and its model, or empty. It is dropped when the test ends.

func URL

func URL(t testing.TB, migrated bool) string

URL is the connection string of a database api of the test's own: migrated, as a copy of the template, or empty, made from template0 with no migration. It is dropped when the test ends.

Types

This section is empty.

Jump to

Keyboard shortcuts

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