testcontainers

package
v0.0.0-...-e6d1e93 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: MIT Imports: 12 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClickHouseContainer

type ClickHouseContainer struct {
	Container testcontainers.Container
	Context   context.Context

	Hosts    []string
	Database string
}

ClickHouseContainer is a ClickHouse testcontainer

func NewClickhouseContainer

func NewClickhouseContainer(ctx context.Context) (*ClickHouseContainer, error)

NewClickhouseContainer creates new Clickhouse test container if CH_TEST_PORT is not defined. Otherwise uses db at defined port. This logic is required for running test at CI environment

func (*ClickHouseContainer) Close

func (ch *ClickHouseContainer) Close() error

Close terminates underlying docker container

func (*ClickHouseContainer) Start

func (ch *ClickHouseContainer) Start() error

func (*ClickHouseContainer) Stop

func (ch *ClickHouseContainer) Stop() error

type MySQLContainer

type MySQLContainer struct {
	Container testcontainers.Container
	Context   context.Context
	Host      string
	Port      int
	Database  string
	Username  string
	Password  string
	// contains filtered or unexported fields
}

MySQLContainer is a MySQL testcontainer

func NewMySQLContainer

func NewMySQLContainer(ctx context.Context) (*MySQLContainer, error)

NewMySQLContainer creates new MySQL test container if MYSQL_TEST_PORT is not defined. Otherwise uses db at defined port. This logic is required for running test at CI environment

func (*MySQLContainer) Close

func (mc *MySQLContainer) Close() error

Close terminates underlying mysql docker container

func (*MySQLContainer) Start

func (mc *MySQLContainer) Start() error

func (*MySQLContainer) Stop

func (mc *MySQLContainer) Stop() error

type PostgresContainer

type PostgresContainer struct {
	Container testcontainers.Container
	Context   context.Context
	Host      string
	Port      int
	Database  string
	Schema    string
	Username  string
	Password  string
	// contains filtered or unexported fields
}

PostgresContainer is a Postgres testcontainer

func NewPostgresContainer

func NewPostgresContainer(ctx context.Context) (*PostgresContainer, error)

NewPostgresContainer creates new Postgres test container if PG_TEST_PORT is not defined. Otherwise uses db at defined port. This logic is required for running test at CI environment

func (*PostgresContainer) Close

func (pgc *PostgresContainer) Close() error

Close terminates underlying postgres docker container

func (*PostgresContainer) CountRows

func (pgc *PostgresContainer) CountRows(table string) (int, error)

CountRows returns row count in DB table with name = table or error if occurred

func (*PostgresContainer) GetSortedRows

func (pgc *PostgresContainer) GetSortedRows(table, selectClause, whereClause, orderClause string) ([]map[string]any, error)

GetSortedRows returns all selected row from table ordered according to orderClause or error if occurred

func (*PostgresContainer) Start

func (pgc *PostgresContainer) Start() error

func (*PostgresContainer) Stop

func (pgc *PostgresContainer) Stop() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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