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) (data.DSN, error)
- func (d *DefaultImpl) GetDS(ctx context.Context) data.DSN
- func (d *DefaultImpl) GetInternalDS(ctx context.Context) data.DSN
- func (d *DefaultImpl) GetRandomisedDS(ctx context.Context, _ string) (data.DSN, func(context.Context), error)
- func (d *DefaultImpl) InternalEndpoint(ctx context.Context, scheme string, port string) (data.DSN, 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 DependancyRes
- type DependencyOption
- func (opt *DependencyOption) All() []DependancyConn
- func (opt *DependencyOption) ByImageName(imageName string) DependancyConn
- func (opt *DependencyOption) ByIsCache(ctx context.Context) DependancyConn
- func (opt *DependencyOption) ByIsDatabase(ctx context.Context) DependancyConn
- func (opt *DependencyOption) ByIsQueue(ctx context.Context) DependancyConn
- func (opt *DependencyOption) Name() string
- func (opt *DependencyOption) Prefix() string
- 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) 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 (*DefaultImpl) InternalEndpoint ¶ added in v1.54.8
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 DependancyRes ¶
type DependancyRes interface {
Name() string
Setup(ctx context.Context, network *testcontainers.DockerNetwork) error
Cleanup(ctx context.Context)
Container() testcontainers.Container
}
type DependencyOption ¶ added in v1.64.1
type DependencyOption struct {
// contains filtered or unexported fields
}
func NewDependancyOption ¶
func NewDependancyOption(name string, prefix string, deps []DependancyConn) *DependencyOption
func (*DependencyOption) All ¶ added in v1.64.1
func (opt *DependencyOption) All() []DependancyConn
func (*DependencyOption) ByImageName ¶ added in v1.64.1
func (opt *DependencyOption) ByImageName(imageName string) DependancyConn
func (*DependencyOption) ByIsCache ¶ added in v1.64.1
func (opt *DependencyOption) ByIsCache(ctx context.Context) DependancyConn
func (*DependencyOption) ByIsDatabase ¶ added in v1.64.1
func (opt *DependencyOption) ByIsDatabase(ctx context.Context) DependancyConn
func (*DependencyOption) ByIsQueue ¶ added in v1.64.1
func (opt *DependencyOption) ByIsQueue(ctx context.Context) DependancyConn
func (*DependencyOption) Name ¶ added in v1.64.1
func (opt *DependencyOption) Name() string
func (*DependencyOption) Prefix ¶ added in v1.64.1
func (opt *DependencyOption) Prefix() string
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
}