tests

package
v0.0.0-...-39f3c58 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrContainerNotInitialized = errors.New("container is not initialized")

Functions

func QueryMatcher

func QueryMatcher(queryLabel string) any

func RunMigrations

func RunMigrations(db *sql.DB) error

RunMigrations runs the database schema migration.

Types

type IntegrationBaseSuite

type IntegrationBaseSuite struct {
	suite.Suite
	Config         config.Config
	DB             database.Database
	RedisClient    *redis.Client
	RedisContainer *RedisContainer
	PGContainer    *PostgreSQLContainer
}

func (*IntegrationBaseSuite) SetupSuite

func (s *IntegrationBaseSuite) SetupSuite()

func (*IntegrationBaseSuite) TearDownSuite

func (s *IntegrationBaseSuite) TearDownSuite()

type PostgreSQLContainer

type PostgreSQLContainer struct {
	TestContainer
}

func NewPostgresContainer

func NewPostgresContainer() (*PostgreSQLContainer, error)

NewPostgresContainer creates a new postgres database docker container for testing.

func (*PostgreSQLContainer) Connect

func (c *PostgreSQLContainer) Connect() (*sqlx.DB, error)

Connect returns a new database connection to the PostgreSQLcontainer.

type RedisContainer

type RedisContainer struct {
	TestContainer
}

func NewRedisContainer

func NewRedisContainer() (*RedisContainer, error)

NewRedisContainer creates a new redis docker container for testing.

func (*RedisContainer) Connect

func (c *RedisContainer) Connect() (*redis.Client, error)

Connect returns a new redis client to the RedisContainer.

type TestContainer

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

func (*TestContainer) Purge

func (c *TestContainer) Purge() error

Purge purges the TestContainer.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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