container

package
v0.2.6 Latest Latest
Warning

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

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

Documentation

Overview

Package container provides a wrapper around the testcontainers-go library to simplify container management in tests.

Index

Constants

View Source
const (
	ErrCreateWithModule           = strerr.Error("failed to create container with testcontainers module")
	ErrCreateWithGenericContainer = strerr.Error("failed to create generic container")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Container

type Container struct {
	// contains filtered or unexported fields
}

func New

func New(opts ...Opt) *Container

func (*Container) Container added in v0.2.0

func (c *Container) Container() testcontainers.Container

Container returns the underlying testcontainers.Container.

func (*Container) Ready

func (c *Container) Ready() error

func (*Container) Start

func (c *Container) Start() error

func (*Container) Stop

func (c *Container) Stop() error

type Opt

type Opt func(*Container) error

func WithGenericContainer

func WithGenericContainer(req testcontainers.GenericContainerRequest) Opt

WithGenericContainer creates a container using the testcontainers.GenericContainer function.

func WithModule

func WithModule[T testcontainers.Container](
	runFn func(ctx context.Context, img string, opts ...testcontainers.ContainerCustomizer) (T, error),
	img string,
	opts ...testcontainers.ContainerCustomizer,
) Opt

WithModule creates a container using the testcontainers-go modules.

func WithReadyFn

func WithReadyFn(fn func(testcontainers.Container) error) Opt

WithReadyFn sets a custom readiness function which should block until ready.

Jump to

Keyboard shortcuts

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