definition

package
v1.63.3 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const ContainerFileMode = 0o755
View Source
const DefaultLogProductionTimeout = 10 * time.Second
View Source
const HostNetworkingMode = "host"

Variables

This section is empty.

Functions

Types

type ContainerOption

type ContainerOption func(req *ContainerOpts)

ContainerOption is a type that can be used to configure the container creation request.

func WithDependancies

func WithDependancies(dependancies ...DependancyConn) ContainerOption

WithDependancies allows to set the dependancies to use for testing.

func WithEnableLogging added in v1.54.7

func WithEnableLogging(enableLogging bool) ContainerOption

WithEnableLogging allows to enable logging to use for testing.

func WithEnvironment added in v1.54.13

func WithEnvironment(environment map[string]string) ContainerOption

WithEnvironment allows to set the environment to use for testing.

func WithImageName

func WithImageName(imageName string) ContainerOption

WithImageName allows to set the image name to use for testing.

func WithLoggingTimeout

func WithLoggingTimeout(loggingTimeout time.Duration) ContainerOption

WithLoggingTimeout allows to set the logging timeout to use for testing.

func WithNetworkAliases added in v1.54.4

func WithNetworkAliases(networkAliases []string) ContainerOption

WithNetworkAliases allows to set the network aliases to use for testing.

func WithPassword

func WithPassword(password string) ContainerOption

WithPassword allows to set the password to use for testing.

func WithPorts added in v1.54.5

func WithPorts(ports ...string) ContainerOption

WithPorts allows to set the ports to use for testing.

func WithUseHostMode

func WithUseHostMode(useHostMode bool) ContainerOption

WithUseHostMode allows to set the use host mode to use for testing.

func WithUserName

func WithUserName(userName string) ContainerOption

WithUserName allows to set the user name to use for testing.

type ContainerOpts

type ContainerOpts struct {
	ImageName string
	UserName  string
	Password  string

	Ports []string

	UseHostMode    bool
	NetworkAliases []string

	Environment  map[string]string
	Dependencies []DependancyConn

	EnableLogging  bool
	LoggingTimeout time.Duration
}

func (*ContainerOpts) ConfigurationExtend added in v1.54.4

func (o *ContainerOpts) ConfigurationExtend(
	ctx context.Context,
	ntwk *testcontainers.DockerNetwork,
	containerCustomize ...testcontainers.ContainerCustomizer,
) []testcontainers.ContainerCustomizer

func (*ContainerOpts) Configure added in v1.54.4

func (o *ContainerOpts) Configure(
	ctx context.Context,
	ntwk *testcontainers.DockerNetwork,
	containerRequest *testcontainers.ContainerRequest,
)

func (*ContainerOpts) Env added in v1.54.13

func (o *ContainerOpts) Env(defaultMap map[string]string) map[string]string

func (*ContainerOpts) Setup

func (o *ContainerOpts) Setup(opts ...ContainerOption)

type DefaultImpl added in v1.54.8

type DefaultImpl struct {
	DefaultScheme string
	DefaultPort   nat.Port
	// contains filtered or unexported fields
}

func NewDefaultImpl added in v1.54.8

func NewDefaultImpl(opts ContainerOpts, scheme string, containerOpts ...ContainerOption) *DefaultImpl

func (*DefaultImpl) Cleanup added in v1.54.8

func (d *DefaultImpl) Cleanup(ctx context.Context)

func (*DefaultImpl) ConfigurationExtend added in v1.54.8

func (d *DefaultImpl) ConfigurationExtend(
	ctx context.Context,
	ntwk *testcontainers.DockerNetwork,
	containerCustomize ...testcontainers.ContainerCustomizer,
) []testcontainers.ContainerCustomizer

func (*DefaultImpl) Configure added in v1.54.8

func (d *DefaultImpl) Configure(
	ctx context.Context,
	ntwk *testcontainers.DockerNetwork,
	containerRequest *testcontainers.ContainerRequest,
)

func (*DefaultImpl) Container added in v1.54.8

func (d *DefaultImpl) Container() testcontainers.Container

func (*DefaultImpl) Endpoint added in v1.54.8

func (d *DefaultImpl) Endpoint(ctx context.Context, scheme string, port string) (data.DSN, error)

func (*DefaultImpl) GetDS added in v1.54.8

func (d *DefaultImpl) GetDS(ctx context.Context) data.DSN

func (*DefaultImpl) GetInternalDS added in v1.54.8

func (d *DefaultImpl) GetInternalDS(ctx context.Context) data.DSN

func (*DefaultImpl) GetRandomisedDS added in v1.54.8

func (d *DefaultImpl) GetRandomisedDS(
	ctx context.Context,
	_ string,
) (data.DSN, func(context.Context), error)

func (*DefaultImpl) InternalEndpoint added in v1.54.8

func (d *DefaultImpl) InternalEndpoint(ctx context.Context, scheme string, port string) (data.DSN, error)

func (*DefaultImpl) Name added in v1.54.8

func (d *DefaultImpl) Name() string

func (*DefaultImpl) Opts added in v1.54.8

func (d *DefaultImpl) Opts() *ContainerOpts

func (*DefaultImpl) PortMapping added in v1.54.8

func (d *DefaultImpl) PortMapping(ctx context.Context, port string) (string, error)

func (*DefaultImpl) SetContainer added in v1.54.8

func (d *DefaultImpl) SetContainer(container testcontainers.Container)

type DependancyConn

type DependancyConn interface {
	Name() string
	PortMapping(ctx context.Context, port string) (string, error)
	GetDS(ctx context.Context) data.DSN
	GetInternalDS(ctx context.Context) data.DSN
	GetRandomisedDS(ctx context.Context, randomisedPrefix string) (data.DSN, func(context.Context), error)
}

type DependancyOption

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

func NewDependancyOption

func NewDependancyOption(name string, prefix string, deps []DependancyConn) *DependancyOption

func (*DependancyOption) All

func (opt *DependancyOption) All() []DependancyConn

func (*DependancyOption) ByImageName added in v1.56.1

func (opt *DependancyOption) ByImageName(imageName string) DependancyConn

func (*DependancyOption) ByIsCache added in v1.56.1

func (opt *DependancyOption) ByIsCache(ctx context.Context) DependancyConn

func (*DependancyOption) ByIsDatabase added in v1.56.1

func (opt *DependancyOption) ByIsDatabase(ctx context.Context) DependancyConn

func (*DependancyOption) ByIsQueue added in v1.56.1

func (opt *DependancyOption) ByIsQueue(ctx context.Context) DependancyConn

func (*DependancyOption) Name

func (opt *DependancyOption) Name() string

func (*DependancyOption) Prefix

func (opt *DependancyOption) Prefix() string

type DependancyRes

type DependancyRes interface {
	Name() string
	Setup(ctx context.Context, network *testcontainers.DockerNetwork) error
	Cleanup(ctx context.Context)
	Container() testcontainers.Container
}

type StdoutLogConsumer

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

func (*StdoutLogConsumer) Accept

func (s *StdoutLogConsumer) Accept(l testcontainers.Log)

Accept prints the log to stdout.

type TestResource

type TestResource interface {
	DependancyRes
	DependancyConn
}

Jump to

Keyboard shortcuts

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