testingcontainers

package
v0.0.0-...-b53ed2c Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Unlicense Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logging

type Logging interface {
	Printf(format string, v ...interface{})
}

func NewLogging

func NewLogging(t *testing.T) Logging

type Network

type Network struct {
	Name string
	// contains filtered or unexported fields
}

func CreateNetwork

func CreateNetwork(ctx context.Context) (Network, error)

func (Network) Cleanup

func (n Network) Cleanup(ctx context.Context) error

type PortMapping

type PortMapping struct {
	ContainerPort int
	HostPort      int
	ContainerURL  string
	HostURL       string
}

type PostgresConfig

type PostgresConfig struct {
	HostName     string
	DatabaseName string
	Network      Network
	Port         string
}

type PostgresDBContainer

type PostgresDBContainer struct {
	testcontainers.Container
	URI      string
	UserName string
	Password string
	Port     string
	Config   PostgresConfig
	// contains filtered or unexported fields
}

func NewPostgresContainer

func NewPostgresContainer(
	ctx context.Context,
	log Logging,
	config PostgresConfig,
) (*PostgresDBContainer, error)

NewPostgresContainer returns a postgres container for use in integration tests or other things

Guidelines:

  • container.Cleanup should always be called at the end of execution, this will shutdown the container and remove what was done inside it.

func (*PostgresDBContainer) Cleanup

func (container *PostgresDBContainer) Cleanup(ctx context.Context) error

Jump to

Keyboard shortcuts

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