testinfra

package
v1.2.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeclareTestAWSInfrastructure

func DeclareTestAWSInfrastructure(ctx context.Context, cfg *mqs.AWSSQSConfig, attributes map[string]string) (string, error)

func DeclareTestGCPInfrastructure

func DeclareTestGCPInfrastructure(ctx context.Context, cfg *mqs.GCPPubSubConfig, endpoint string) error

func EnsureGCP

func EnsureGCP() string

func EnsureKafka added in v0.16.0

func EnsureKafka() string

func EnsureLocalStack

func EnsureLocalStack() string

func EnsureRabbitMQ

func EnsureRabbitMQ() string

func GetAzureSBConnString added in v0.4.0

func GetAzureSBConnString() string

func GetMQAzureConfig added in v0.4.0

func GetMQAzureConfig(t *testing.T, testName string) mqs.QueueConfig

func GetMockServer

func GetMockServer(t *testing.T) string

func NewClickHouseConfig

func NewClickHouseConfig(t *testing.T) clickhouse.ClickHouseConfig

func NewDragonflyConfig added in v0.11.0

func NewDragonflyConfig(t *testing.T) *redis.RedisConfig

NewDragonflyConfig spins up a dedicated Dragonfly container for the test. Each caller gets its own isolated container on DB 0, eliminating cross-test interference. The container is terminated on cleanup.

func NewDragonflyStackConfig added in v0.12.0

func NewDragonflyStackConfig(t *testing.T) *redis.RedisConfig

NewDragonflyStackConfig is an alias for NewDragonflyConfig. Kept for backward compatibility with existing test code.

func NewMQAWSConfig

func NewMQAWSConfig(t *testing.T, attributes map[string]string) mqs.QueueConfig

func NewMQGCPConfig

func NewMQGCPConfig(t *testing.T, attributes map[string]string) mqs.QueueConfig

func NewMQRabbitMQConfig

func NewMQRabbitMQConfig(t *testing.T) mqs.QueueConfig

func NewPostgresConfig

func NewPostgresConfig(t *testing.T) string

func NewRedisConfig added in v0.11.0

func NewRedisConfig(t *testing.T) *redis.RedisConfig

NewRedisConfig spins up a dedicated Redis container for the test. Use this for tests that don't need RediSearch. The container is terminated on cleanup.

func NewRedisStackConfig added in v0.12.0

func NewRedisStackConfig(t *testing.T) *redis.RedisConfig

NewRedisStackConfig spins up a dedicated Redis Stack container for tests requiring RediSearch. Each test gets its own isolated container, eliminating cross-test interference. The container is terminated on cleanup.

func Start

func Start(t *testing.T) func()

Start marks a suite as needing test infrastructure and returns the func to defer at the end of it.

The containers started for the TESTINFRA-unset path are shared by every suite in a test binary and deliberately outlive all of them: they are torn down by the testcontainers reaper when the process exits. Stopping them when a suite finishes does not work, because the sync.Once guarding each container has already fired — the next suite would reuse an endpoint with nothing behind it.

func TeardownTestAWSInfrastructure

func TeardownTestAWSInfrastructure(ctx context.Context, cfg *mqs.AWSSQSConfig) error

func TeardownTestGCPInfrastructure

func TeardownTestGCPInfrastructure(ctx context.Context, cfg *mqs.GCPPubSubConfig, endpoint string) error

Types

type Config

type Config struct {
	TestInfra         bool
	TestAzure         bool
	ClickHouseURL     string
	PostgresURL       string
	LocalStackURL     string
	RabbitMQURL       string
	KafkaURL          string
	MockServerURL     string
	GCPURL            string
	AzureSBConnString string
	Images            Images
}

func ReadConfig

func ReadConfig() *Config

type Images added in v1.2.0

type Images struct {
	Postgres   string
	ClickHouse string
	RabbitMQ   string
	Kafka      string
	LocalStack string
	GCP        string
	Redis      string
	Dragonfly  string
}

Images holds the container images testcontainers starts when TESTINFRA is unset. They are the same images build/test/compose.yml runs, read from the same .env.test, so a test sees one environment either way.

type MockServerInfra

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

func NewMockServerInfra

func NewMockServerInfra(baseURL string) *MockServerInfra

func (*MockServerInfra) NewMockDestination

func (mock *MockServerInfra) NewMockDestination(t *testing.T, destination models.Destination)

type PGDB

type PGDB struct{}

Jump to

Keyboard shortcuts

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