testutils

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CheckViolationErrorCode   string = "check_violation"
	FKViolationErrorCode      string = "foreign_key_violation"
	NotNullViolationErrorCode string = "not_null_violation"
	UniqueViolationErrorCode  string = "unique_violation"
)

Variables

This section is empty.

Functions

func SharedTestMain

func SharedTestMain(m *testing.M)

SharedTestMain starts a postgres container to be used by all tests in a package. Each test then connects to the container and creates a new database.

func TestSchema

func TestSchema() string

TestSchema returns the schema in which migration tests apply migrations. By default, migrations will be applied to the "public" schema.

func WithMigratorAndConnectionToContainer

func WithMigratorAndConnectionToContainer(t *testing.T, fn func(mig *roll.Roll, db *sql.DB))

func WithMigratorInSchemaAndConnectionToContainer

func WithMigratorInSchemaAndConnectionToContainer(t *testing.T, schema string, fn func(mig *roll.Roll, db *sql.DB))

func WithMigratorInSchemaAndConnectionToContainerWithOptions

func WithMigratorInSchemaAndConnectionToContainerWithOptions(t *testing.T, schema string, opts []roll.Option, fn func(mig *roll.Roll, db *sql.DB))

func WithStateAndConnectionToContainer

func WithStateAndConnectionToContainer(t *testing.T, fn func(*state.State, *sql.DB))

Types

This section is empty.

Jump to

Keyboard shortcuts

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