containers

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LocalstackTestContainer

type LocalstackTestContainer struct {
	Container testcontainers.Container
	Endpoint  string
	// contains filtered or unexported fields
}

LocalstackTestContainer is a wrapper around a testcontainers.Container that provides an S3 endpoint

func NewLocalstackTestContainer

func NewLocalstackTestContainer(ctx context.Context, t *testing.T) *LocalstackTestContainer

NewLocalstackTestContainer creates a new Localstack test container and returns a LocalstackTestContainer instance

func (*LocalstackTestContainer) Close

Close terminates the container

func (*LocalstackTestContainer) MakeS3Connection

func (lc *LocalstackTestContainer) MakeS3Connection(ctx context.Context, t *testing.T) (client *s3.Client, bucketName string)

MakeS3Connection creates a new S3 connection using the test container endpoint and returns the connection and a bucket name

type MongoTestContainer

type MongoTestContainer struct {
	Container testcontainers.Container
	URI       string
	Client    *mongo.Client
	// contains filtered or unexported fields
}

MongoTestContainer wraps testcontainers.Container and provides MongoDB client

func NewMongoTestContainer

func NewMongoTestContainer(ctx context.Context, t *testing.T, mongoVersion int) *MongoTestContainer

NewMongoTestContainer creates a new MongoDB test container

func (*MongoTestContainer) Close

func (mc *MongoTestContainer) Close(ctx context.Context) error

Close disconnects client, terminates container and restores original environment

func (*MongoTestContainer) Collection

func (mc *MongoTestContainer) Collection(dbName string) *mongo.Collection

Collection returns a new collection with unique name for tests

type MySQLTestContainer

type MySQLTestContainer struct {
	Container testcontainers.Container
	Host      string
	Port      nat.Port
	User      string
	Password  string
	Database  string
}

MySQLTestContainer is a wrapper around a testcontainers.Container that provides a MySQL server

func NewMySQLTestContainer

func NewMySQLTestContainer(ctx context.Context, t *testing.T) *MySQLTestContainer

NewMySQLTestContainer creates a new MySQL test container with default settings

func NewMySQLTestContainerWithDB

func NewMySQLTestContainerWithDB(ctx context.Context, t *testing.T, dbName string) *MySQLTestContainer

NewMySQLTestContainerWithDB creates a new MySQL test container with a specific database name

func (*MySQLTestContainer) Close

func (mc *MySQLTestContainer) Close(ctx context.Context) error

Close terminates the container

func (*MySQLTestContainer) ConnectionString

func (mc *MySQLTestContainer) ConnectionString() string

ConnectionString returns the MySQL connection string for this container

func (*MySQLTestContainer) DSN

func (mc *MySQLTestContainer) DSN() string

DSN returns the MySQL DSN for this container

type PostgresTestContainer

type PostgresTestContainer struct {
	Container testcontainers.Container
	Host      string
	Port      nat.Port
	User      string
	Password  string
	Database  string
}

PostgresTestContainer is a wrapper around a testcontainers.Container that provides a PostgreSQL server

func NewPostgresTestContainer

func NewPostgresTestContainer(ctx context.Context, t *testing.T) *PostgresTestContainer

NewPostgresTestContainer creates a new PostgreSQL test container with default settings

func NewPostgresTestContainerWithDB

func NewPostgresTestContainerWithDB(ctx context.Context, t *testing.T, dbName string) *PostgresTestContainer

NewPostgresTestContainerWithDB creates a new PostgreSQL test container with a specific database name

func (*PostgresTestContainer) Close

func (pc *PostgresTestContainer) Close(ctx context.Context) error

Close terminates the container

func (*PostgresTestContainer) ConnectionString

func (pc *PostgresTestContainer) ConnectionString() string

ConnectionString returns the PostgreSQL connection string for this container

type SSHTestContainer

type SSHTestContainer struct {
	Container testcontainers.Container
	Host      string
	Port      nat.Port
	User      string
}

SSHTestContainer is a wrapper around a testcontainers.Container that provides an SSH server

func NewSSHTestContainer

func NewSSHTestContainer(ctx context.Context, t *testing.T) *SSHTestContainer

NewSSHTestContainer creates a new SSH test container and returns an SSHTestContainer instance

func NewSSHTestContainerWithUser

func NewSSHTestContainerWithUser(ctx context.Context, t *testing.T, user string) *SSHTestContainer

NewSSHTestContainerWithUser creates a new SSH test container with a specific user

func (*SSHTestContainer) Address

func (sc *SSHTestContainer) Address() string

Address returns the SSH server address in host:port format

func (*SSHTestContainer) Close

func (sc *SSHTestContainer) Close(ctx context.Context) error

Close terminates the container

Jump to

Keyboard shortcuts

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