Documentation ¶
Index ¶
- func GetFreePort() (int, error)
- func GetFreePortOr(fallback int) int
- type ContainerStartOption
- func WithCmd(cmd ...string) ContainerStartOption
- func WithEnvVariable(key, value string) ContainerStartOption
- func WithPortBinding(host, container int) ContainerStartOption
- func WithStartupDelay(delay time.Duration) ContainerStartOption
- func WithStartupProbe(cmd ...string) ContainerStartOption
- func WithStartupProbeSkew(t time.Duration) ContainerStartOption
- type Logger
- type Manager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetFreePort ¶
GetFreePort asks the kernel for a free open port that is ready to use.
taken from: github.com/phayes/freeport
func GetFreePortOr ¶
GetFreePortOr tries to get a free port from system kernel and returns the fallback value otherwise
Types ¶
type ContainerStartOption ¶
type ContainerStartOption func(*containerStartConfig)
func WithCmd ¶
func WithCmd(cmd ...string) ContainerStartOption
WithCmd specifies the command to be used at container start
func WithEnvVariable ¶
func WithEnvVariable(key, value string) ContainerStartOption
WithEnvVariable sets an environment variable (can be used multiple times)
func WithPortBinding ¶
func WithPortBinding(host, container int) ContainerStartOption
WithPortBinding binds container port to host's port (can be used multiple times)
func WithStartupDelay ¶
func WithStartupDelay(delay time.Duration) ContainerStartOption
WithStartupDelay delays the closing of the ready channel.
If used alongside startup probe command, the ready channel is closed whenever one of the conditions finishes first.
func WithStartupProbe ¶
func WithStartupProbe(cmd ...string) ContainerStartOption
WithStartupProbe runs the provided command inside container periodically until it returns zero exit code and then closes the ready channel.
If used alongside startup delay, the ready channel is closed whenever one of the conditions finishes first.
func WithStartupProbeSkew ¶
func WithStartupProbeSkew(t time.Duration) ContainerStartOption
WithStartupProbeSkew adds an aditional delay at the end of the startup probe operation; total delay is therefore: startup probe + skew
This has no effect on startup delay
type Logger ¶
func WithTestingLogger ¶
WithTestingLogger adapts testing.T as a logger for Logger interface.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func (*Manager) StartContainer ¶
func (m *Manager) StartContainer(image string, opts ...ContainerStartOption) (chan struct{}, error)
StartContainer starts the specified container with provided image and options. It returns a "ready" channel, that is closed whenever the container is considered to be up. The behaviour of the readiness channel can be configured using several options.