integration

package
v0.0.0-...-104485b Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package integration provides integration test infrastructure.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunMigrations

func RunMigrations(db *sql.DB) error

RunMigrations runs database migrations.

func WithFullEnvironment

func WithFullEnvironment(t *testing.T, fn func(t *testing.T, env *TestEnvironment))

WithFullEnvironment runs a test with all containers.

func WithOPA

func WithOPA(t *testing.T, fn func(t *testing.T, opa *OPAContainer))

WithOPA runs a test with an OPA container.

func WithPostgres

func WithPostgres(t *testing.T, fn func(t *testing.T, pg *PostgresContainer))

WithPostgres runs a test with a Postgres container.

func WithPostgresDB

func WithPostgresDB(t *testing.T, fn func(t *testing.T, db *sql.DB))

WithPostgresDB runs a test with an open database connection.

func WithVault

func WithVault(t *testing.T, fn func(t *testing.T, vault *VaultContainer))

WithVault runs a test with a Vault container.

Types

type ContainerConfig

type ContainerConfig struct {
	PostgresImage string
	VaultImage    string
	OPAImage      string
}

ContainerConfig holds configuration for test containers.

func DefaultContainerConfig

func DefaultContainerConfig() *ContainerConfig

DefaultContainerConfig returns default container configuration.

type OPAContainer

type OPAContainer struct {
	Container testcontainers.Container
	Address   string
}

OPAContainer wraps an OPA testcontainer.

type PostgresContainer

type PostgresContainer struct {
	Container testcontainers.Container
	Host      string
	Port      string
	User      string
	Password  string
	Database  string
}

PostgresContainer wraps a Postgres testcontainer.

func (*PostgresContainer) ConnectionString

func (p *PostgresContainer) ConnectionString() string

ConnectionString returns the Postgres connection string.

type TestEnvironment

type TestEnvironment struct {
	Postgres *PostgresContainer
	Vault    *VaultContainer
	OPA      *OPAContainer
}

TestEnvironment holds all test containers.

type VaultContainer

type VaultContainer struct {
	Container testcontainers.Container
	Address   string
	Token     string
}

VaultContainer wraps a Vault testcontainer.

Jump to

Keyboard shortcuts

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