Documentation ¶
Index ¶
- type Container
- type Containers
- func (c *Containers) Cleanup()
- func (c *Containers) RemoveContainer(container Container) error
- func (c *Containers) RenameContainer(container Container, name string) error
- func (c *Containers) StartImage(image string, opts ...Option) Container
- func (c *Containers) StartImageWithEnv(image string, env []string, opts ...Option) Container
- type ID
- type Option
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 ¶
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 Option ¶
type Option func(c *Container)
Option is passed when starting a container to control the start options.
func WithPortReady ¶
WithPortReady declares that the provided container port should be able to be connected to before returning from StartImage.