containers

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2026 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package containers provides shared helpers for starting testcontainers with uniform retry behavior. It exists so every container builder in the repo can opt into the same backoff policy instead of each rolling its own.

Container startup flakes for many non-deterministic reasons — Docker daemon cold starts, port conflicts, image pull stalls, transient network blips — and a single attempt is too brittle for a large integration test suite.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultRetryConfig

func DefaultRetryConfig() retry.Config

DefaultRetryConfig returns the retry.Config used by StartWithRetry. Callers that need bespoke retry behavior can start from this and tweak individual fields before calling retry.NewExponentialBackoffPolicy themselves.

func StartWithRetry

func StartWithRetry[C any](ctx context.Context, start func(context.Context) (C, error)) (C, error)

StartWithRetry invokes start with exponential backoff retry on failure. It is a thin wrapper over the retry package so that every container builder in the repo gets the same backoff policy for free.

The callback receives the same ctx that was passed in, and is expected to return the concrete container type from its module's Run function (e.g. *postgres.PostgresContainer, *redis.RedisContainer). Callers handle the error themselves — typically via must.NoError(t, err) — so that this helper stays decoupled from the testing package.

Types

This section is empty.

Jump to

Keyboard shortcuts

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