db_integration_test_suite

package
v0.0.0-...-1a859cd Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2025 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DbIntegrationTestBaseSuite

type DbIntegrationTestBaseSuite struct {
	suite.Suite

	DB             *sql.DB
	InsertedValues *db_populator.KnownValues
	// contains filtered or unexported fields
}

Base test suite for integration tests requiring sql database connection

func (*DbIntegrationTestBaseSuite) SetupSuite

func (s *DbIntegrationTestBaseSuite) SetupSuite()

Runs once at test suite setup. Creates test psql container, creates a databse connection and sets a pointer to it as the struct field.

func (*DbIntegrationTestBaseSuite) SetupTest

func (s *DbIntegrationTestBaseSuite) SetupTest()

Runs before each test. Migrates the database up, runs population (seeding) function.

func (*DbIntegrationTestBaseSuite) TearDownSuite

func (s *DbIntegrationTestBaseSuite) TearDownSuite()

Ran when the suite is done. Closes the DB conenction and terminates the container.

func (*DbIntegrationTestBaseSuite) TearDownTest

func (s *DbIntegrationTestBaseSuite) TearDownTest()

Runs after each test. Migrates the DB all the way down, removing all data.

type PostgreSQLContainer

type PostgreSQLContainer struct {
	testcontainers.Container
	MappedPort string
	Host       string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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