integrationtesting

package
v0.0.0-...-e785680 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const IntegrationRunnerEnvVar = "RUN_INTEGRATION_TESTS"

Variables

This section is empty.

Functions

This section is empty.

Types

type ElasticDockerInstance

type ElasticDockerInstance struct {
	ConnURL string
}

ElasticDockerInstance is a config with ElasticSearch connection settings.

func RunElasticsearchDockerContainer

func RunElasticsearchDockerContainer() (ElasticDockerInstance, func(), error)

RunElasticsearchDockerContainer creates new ElasticSearch test container and initializes application repositories. Returns cleanup function that must be called.

type MongoDockerInstance

type MongoDockerInstance struct {
	ConnURL  string
	UserName string
	UserPass string
}

MongoDockerInstance is a config with MongoDB connection settings.

func RunMongoDockerContainer

func RunMongoDockerContainer() (MongoDockerInstance, func(), error)

RunMongoDockerContainer creates new MongoDB test container and initializes application repositories. Returns cleanup function that must be called.

type PostgresDockerInstance

type PostgresDockerInstance struct {
	// ConnURL is a fully constructed connection URL with all resolved values, using this template: "postgres://%s:%s@%s:%s/%s?sslmode=disable".
	ConnURL string
	// UserName is a username used for DB connection.
	UserName string
	// UserPass is a user password used for DB connection.
	UserPass string
	// DbName is a name of the DB.
	DbName string
	// contains filtered or unexported fields
}

PostgresDockerInstance represents a running Postgres test container with settings.

func RunPostgresDockerContainer

func RunPostgresDockerContainer() (PostgresDockerInstance, func(), error)

RunPostgresDockerContainer creates a new Postgres test container and initializes the application repositories. It returns a cleanup function that must be called to terminate the container.

func (*PostgresDockerInstance) MustTruncateData

func (p *PostgresDockerInstance) MustTruncateData()

MustTruncateData truncates all data in the Postgres DB. Can be used after the tests to clean up all the user's data.

It panics if the truncation fails.

type PostgresSuite

type PostgresSuite struct {
	suite.Suite
	// contains filtered or unexported fields
}

PostgresSuite is a basic integration suite for Postgres-related integration tests.

func (*PostgresSuite) GetPostgresConnectionURL

func (suite *PostgresSuite) GetPostgresConnectionURL() string

GetPostgresConnectionURL returns connection URL to integration Postgres in Docker.

func (*PostgresSuite) PgxPool

func (suite *PostgresSuite) PgxPool() *pgxpool.Pool

PgxPool returns a connection pool to integration Postgres in Docker.

func (*PostgresSuite) SetupSuite

func (suite *PostgresSuite) SetupSuite()

SetupSuite will run before the tests in the suite are run.

func (*PostgresSuite) TearDownSuite

func (suite *PostgresSuite) TearDownSuite()

TearDownSuite will run after all the tests in the suite have been run.

func (*PostgresSuite) TearDownTest

func (suite *PostgresSuite) TearDownTest()

TearDownTest will run after each test in the suite.

Jump to

Keyboard shortcuts

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