Documentation
¶
Index ¶
- Constants
- func LogConfig(ctx context.Context, timeout time.Duration) *testcontainers.LogConsumerConfig
- type ContainerOption
- func WithDependancies(dependancies ...DependancyConn) ContainerOption
- func WithEnableLogging(enableLogging bool) ContainerOption
- func WithEnvironment(environment map[string]string) ContainerOption
- func WithImageName(imageName string) ContainerOption
- func WithLoggingTimeout(loggingTimeout time.Duration) ContainerOption
- func WithNetworkAliases(networkAliases []string) ContainerOption
- func WithPassword(password string) ContainerOption
- func WithPorts(ports ...string) ContainerOption
- func WithUseHostMode(useHostMode bool) ContainerOption
- func WithUserName(userName string) ContainerOption
- type ContainerOpts
- func (o *ContainerOpts) ConfigurationExtend(ctx context.Context, ntwk *testcontainers.DockerNetwork, ...) []testcontainers.ContainerCustomizer
- func (o *ContainerOpts) Configure(ctx context.Context, ntwk *testcontainers.DockerNetwork, ...)
- func (o *ContainerOpts) Env(defaultMap map[string]string) map[string]string
- func (o *ContainerOpts) Setup(opts ...ContainerOption)
- type DefaultImpl
- func (d *DefaultImpl) Cleanup(ctx context.Context)
- func (d *DefaultImpl) ConfigurationExtend(ctx context.Context, ntwk *testcontainers.DockerNetwork, ...) []testcontainers.ContainerCustomizer
- func (d *DefaultImpl) Configure(ctx context.Context, ntwk *testcontainers.DockerNetwork, ...)
- func (d *DefaultImpl) Container() testcontainers.Container
- func (d *DefaultImpl) Endpoint(ctx context.Context, scheme string, port string) (frame.DataSource, error)
- func (d *DefaultImpl) GetDS(ctx context.Context) frame.DataSource
- func (d *DefaultImpl) GetInternalDS(ctx context.Context) frame.DataSource
- func (d *DefaultImpl) GetRandomisedDS(ctx context.Context, _ string) (frame.DataSource, func(context.Context), error)
- func (d *DefaultImpl) InternalEndpoint(ctx context.Context, scheme string, port string) (frame.DataSource, error)
- func (d *DefaultImpl) Name() string
- func (d *DefaultImpl) Opts() *ContainerOpts
- func (d *DefaultImpl) PortMapping(ctx context.Context, port string) (string, error)
- func (d *DefaultImpl) SetContainer(container testcontainers.Container)
- type DependancyConn
- type DependancyOption
- func (opt *DependancyOption) All() []DependancyConn
- func (opt *DependancyOption) ByImageName(imageName string) DependancyConn
- func (opt *DependancyOption) ByIsCache(ctx context.Context) DependancyConn
- func (opt *DependancyOption) ByIsDatabase(ctx context.Context) DependancyConn
- func (opt *DependancyOption) ByIsQueue(ctx context.Context) DependancyConn
- func (opt *DependancyOption) Name() string
- func (opt *DependancyOption) Prefix() string
- type DependancyRes
- type StdoutLogConsumer
- type TestResource
Constants ¶
const ContainerFileMode = 0o755
const DefaultLogProductionTimeout = 10 * time.Second
const HostNetworkingMode = "host"
Variables ¶
This section is empty.
Functions ¶
func LogConfig ¶
func LogConfig(ctx context.Context, timeout time.Duration) *testcontainers.LogConsumerConfig
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) (frame.DataSource, error)
func (*DefaultImpl) GetDS ¶ added in v1.54.8
func (d *DefaultImpl) GetDS(ctx context.Context) frame.DataSource
func (*DefaultImpl) GetInternalDS ¶ added in v1.54.8
func (d *DefaultImpl) GetInternalDS(ctx context.Context) frame.DataSource
func (*DefaultImpl) GetRandomisedDS ¶ added in v1.54.8
func (d *DefaultImpl) GetRandomisedDS( ctx context.Context, _ string, ) (frame.DataSource, func(context.Context), error)
func (*DefaultImpl) InternalEndpoint ¶ added in v1.54.8
func (d *DefaultImpl) InternalEndpoint(ctx context.Context, scheme string, port string) (frame.DataSource, 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 (*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) frame.DataSource
GetInternalDS(ctx context.Context) frame.DataSource
GetRandomisedDS(ctx context.Context, randomisedPrefix string) (frame.DataSource, 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
}