storetest

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package storetest gives tests a fresh, migrated PostgreSQL database.

It uses the server at PANELARR_TEST_DATABASE_URL when set, otherwise it starts a postgres container with testcontainers (once per test binary). Each call creates its own database and drops it when the test ends, so tests can run in parallel. The role only needs CREATEDB.

Index

Constants

View Source
const Image = "postgres:18-alpine"

Image is the PostgreSQL image used when no server is configured.

Variables

This section is empty.

Functions

func New

func New(t testing.TB) *store.Store

New returns a store on a fresh, migrated database.

func Open

func Open(t testing.TB) *store.Store

Open returns a store on a fresh database without running migrations.

func URL

func URL(t testing.TB) string

URL creates an empty database and returns its URL. The database 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