postgresintegration

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: 10 Imported by: 0

Documentation

Index

Constants

View Source
const IntegrationRunnerEnvVar = "RUN_INTEGRATION_TESTS"

Variables

This section is empty.

Functions

func IsSkipIntegrationTest

func IsSkipIntegrationTest(t *testing.T) bool

IsSkipIntegrationTest returns true if the integration test should be skipped.

Types

type PostgresDockerInstance

type PostgresDockerInstance struct {
	// contains filtered or unexported fields
}

PostgresDockerInstance represents a running Postgres test container with settings.

func MustRunPostgresDockerContainer

func MustRunPostgresDockerContainer() (PostgresDockerInstance, func())

MustRunPostgresDockerContainer creates a new Postgres test container and initializes the application repositories. It returns a cleanup function that must be called to terminate the container. It panics if the container cannot be started.

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) ConnURL

func (p *PostgresDockerInstance) ConnURL() string

ConnURL returns a fully constructed connection URL with all resolved values, using this template: "postgres://%s:%s@%s:%s/%s?sslmode=disable".

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.

func (*PostgresDockerInstance) PgxPool

func (p *PostgresDockerInstance) PgxPool() *pgxpool.Pool

PgxPool returns a PGX connection pool that can be used to execute queries against the Postgres DB.

func (*PostgresDockerInstance) TruncateDataInTest

func (p *PostgresDockerInstance) TruncateDataInTest(t *testing.T)

Jump to

Keyboard shortcuts

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