testcontainers

package
v0.0.0-...-a679988 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package testcontainers provides helpers for spinning up ephemeral infrastructure containers in integration and smoke tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResolveHost

func ResolveHost(t *testing.T, host string) string

ResolveHost resolves a container host to an IP address suitable for connecting from the host to a container. On Docker Desktop (Windows/macOS) the host may need special handling.

Types

type Container

type Container struct {
	Postgres *postgres.PostgresContainer
	Valkey   *valkey.ValkeyContainer
	RabbitMQ *rabbitmq.RabbitMQContainer

	PostgresHost string
	PostgresPort int
	ValkeyHost   string
	ValkeyPort   int
	RabbitMQHost string
	RabbitMQPort int
}

Container holds connection info for started infrastructure containers.

func StartInfrastructure

func StartInfrastructure(t *testing.T) *Container

StartInfrastructure starts PostgreSQL, Valkey and RabbitMQ containers and returns a Container struct with connection details. Containers are automatically terminated when the test ends.

Jump to

Keyboard shortcuts

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