Documentation
¶
Overview ¶
Package integration provides integration test infrastructure.
Index ¶
- func RunMigrations(db *sql.DB) error
- func WithFullEnvironment(t *testing.T, fn func(t *testing.T, env *TestEnvironment))
- func WithOPA(t *testing.T, fn func(t *testing.T, opa *OPAContainer))
- func WithPostgres(t *testing.T, fn func(t *testing.T, pg *PostgresContainer))
- func WithPostgresDB(t *testing.T, fn func(t *testing.T, db *sql.DB))
- func WithVault(t *testing.T, fn func(t *testing.T, vault *VaultContainer))
- type ContainerConfig
- type OPAContainer
- type PostgresContainer
- type TestEnvironment
- type VaultContainer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 ¶
WithPostgresDB runs a test with an open database connection.
Types ¶
type ContainerConfig ¶
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.
Click to show internal directories.
Click to hide internal directories.