containertest

package module
v0.64.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Container

type Container struct {
	ID ID
	// contains filtered or unexported fields
}

Container is a running container instance.

func (*Container) AddrForPort

func (c *Container) AddrForPort(port uint16) string

AddrForPort returns the endpoint with host:port for the container port.

type Containers

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

Containers holds the set of running containers during the test.

func New

func New(t *testing.T) *Containers

New wraps the provided testing.T instance so that any containers started will be cleaned up when the test completes.

func (*Containers) Cleanup

func (c *Containers) Cleanup()

Cleanup stops and removes all containers. It is called automatically when the test completes if called from New() but can also be called manually if needed. It is idempotent.

func (*Containers) RemoveContainer

func (c *Containers) RemoveContainer(container Container) error

func (*Containers) RenameContainer

func (c *Containers) RenameContainer(container Container, name string) error

func (*Containers) StartImage

func (c *Containers) StartImage(image string, opts ...Option) Container

StartImage starts a container with the given image and zero or more ContainerOptions.

func (*Containers) StartImageWithEnv

func (c *Containers) StartImageWithEnv(image string, env []string, opts ...Option) Container

type ID

type ID string

ID identifies a container instance.

type Option

type Option func(c *Container)

Option is passed when starting a container to control the start options.

func WithPortReady

func WithPortReady(port uint16) Option

WithPortReady declares that the provided container port should be able to be connected to before returning from StartImage.

Jump to

Keyboard shortcuts

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