Documentation ¶
Overview ¶
Package dockertest is inspired by github.com/ory-am/dockertest@v3.
Index ¶
- func GetPort(container *dc.Container, id string) string
- func GetServiceAddr(container *dc.Container, portID string) string
- func Retry(maxWait time.Duration, op func() error) error
- type ContainerList
- type Env
- type Pool
- func (p *Pool) CreateNetwork(name string) (*dc.Network, error)
- func (p *Pool) GetContainer(name string) (*dc.Container, bool)
- func (p *Pool) PullImage(image string) error
- func (p *Pool) PurgeAll() error
- func (p *Pool) PurgeContainer(container *dc.Container) error
- func (p *Pool) PurgeContainers(containers ContainerList) error
- func (p *Pool) PurgeNetwork(net *dc.Network) error
- func (p *Pool) RunContainer(image string, env Env, pullImage bool) (*dc.Container, error)
- func (p *Pool) RunContainerWithOpts(opts dc.CreateContainerOptions) (*dc.Container, error)
- func (p *Pool) RunMultipleContainers(opts []dc.CreateContainerOptions) (ContainerList, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetPort ¶
GetPort returns a bound host port in the container. `id` is an id of the exposed port in the container.
func GetServiceAddr ¶
GetServiceAddr returns a local host with port for the container.
Types ¶
type ContainerList ¶
ContainerList is a list of `*dc.Container`.
func (ContainerList) Remove ¶
func (c ContainerList) Remove(search *dc.Container) ContainerList
Remove removes an item from `ContainerList`.
type Pool ¶
type Pool struct { Client *dc.Client Containers ContainerList Networks []*dc.Network // contains filtered or unexported fields }
Pool manages created docker artifacts.
func (*Pool) CreateNetwork ¶
CreateNetwork creates a new network in the docker.
func (*Pool) GetContainer ¶
GetContainer returns container struct by name. Remember to preceed name with `/`. This is how go-dockerclient works.
func (*Pool) PurgeContainer ¶
PurgeContainer stops and removes container from the docker.
func (*Pool) PurgeContainers ¶
func (p *Pool) PurgeContainers(containers ContainerList) error
PurgeContainers removes containers passed as in the argument.
func (*Pool) PurgeNetwork ¶
PurgeNetwork removes network from the container.
func (*Pool) RunContainer ¶
RunContainer runs a container with a given image and env vars. It's a short version of `RunContainerWithOpts()`.
func (*Pool) RunContainerWithOpts ¶
RunContainerWithOpts runs a container based on given options.
func (*Pool) RunMultipleContainers ¶
func (p *Pool) RunMultipleContainers( opts []dc.CreateContainerOptions, ) (ContainerList, error)
RunMultipleContainers spawns multiple containers asynchronously.