testsupport

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package testsupport spins up ephemeral Postgres and Redis via testcontainers for integration tests. Tests that call these helpers are named *Integration and run under `go test -run Integration`; they skip when Docker is absent.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DiscardLogger

func DiscardLogger() *slog.Logger

DiscardLogger returns a logger that drops everything (for integration tests).

func Postgres

func Postgres(t *testing.T) (*pgxpool.Pool, string)

Postgres starts a throwaway Postgres, migrates it, and returns a connected pool.

func Redis

func Redis(t *testing.T) *redis.Client

Redis starts a throwaway Redis and returns a connected client.

func RedisPausable

func RedisPausable(t *testing.T) (rdb *redis.Client, pause, unpause func())

RedisPausable starts a throwaway Redis and returns the client plus pause/unpause controls that docker-PAUSE the container — freezing the process while PRESERVING its data. That is the faithful way to model a Redis outage and recovery for a live event: while paused, client ops hit real dial/read timeouts (bounded below so the test fails fast, not hangs), and on unpause the sessions and freeze snapshot are intact so "does it resume?" is a real question. Preferred over closing the client, which would mock away the timeout and reconnect paths this exists to exercise.

Types

This section is empty.

Jump to

Keyboard shortcuts

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