testhelpers

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2026 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Overview

Package testhelpers provides shared testcontainers-go setup for PG and CH used by per-package integration tests and the e2e boot test.

This package is never imported by production code, so it (and its testcontainers dependency tree) is absent from the final binary. The test-only build path is enforced socially — no //go:build tag — but a CI check could grep for production imports if drift becomes a worry.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartClickHouse

func StartClickHouse(t *testing.T) (*sql.DB, config.Config)

StartClickHouse boots a fresh clickhouse-server container with admin credentials matching what the app expects (mere_admin), and returns an admin-authenticated *sql.DB plus a Config pre-populated with the container's host/port. The readonly user is NOT pre-provisioned — that's what the app's ProvisionReadonlyUser is supposed to do, so the integration tests cover it.

func StartClickHouseC

func StartClickHouseC(t *testing.T) (*sql.DB, config.Config, testcontainers.Container)

StartClickHouseC is StartClickHouse plus the raw container handle, for tests that Stop/Start the dependency to exercise recovery paths. Unlike StartClickHouse it pins the native 9000 port to a fixed host port, because Docker reassigns an ephemeral port on Stop/Start — pinning lets the returned *sql.DB reconnect on the same address after a restart.

func StartPostgres

func StartPostgres(t *testing.T) (*pgxpool.Pool, config.Config)

StartPostgres boots a fresh postgres:16 container, waits until it accepts connections, and returns a connected pgxpool plus a Config pre-populated with the container's host/port and credentials. The container and pool are torn down via t.Cleanup. The host port is ephemeral.

func StartPostgresC

func StartPostgresC(t *testing.T) (*pgxpool.Pool, config.Config, testcontainers.Container)

StartPostgresC is StartPostgres plus the raw container handle, for tests that Stop/Start the dependency to exercise recovery paths. Unlike StartPostgres it pins a fixed host port, because Docker reassigns an ephemeral port on Stop/Start — pinning lets the returned pool reconnect on the same address after a restart.

Types

This section is empty.

Jump to

Keyboard shortcuts

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