Documentation ¶
Index ¶
- func Retry(code func() bool, timeout, sleep time.Duration)
- type Composer
- type DockerComposer
- func (dc *DockerComposer) AttachToNet(service string) error
- func (dc *DockerComposer) BlockPort(service string, port int) error
- func (dc *DockerComposer) DetachFromNet(service string) error
- func (dc *DockerComposer) Down() error
- func (dc *DockerComposer) GetAddr(service string, port int) (string, error)
- func (dc *DockerComposer) GetFile(service, path string) (io.ReadCloser, error)
- func (dc *DockerComposer) GetIP(service string) (string, error)
- func (dc *DockerComposer) RunAsyncCommand(service string, cmd string) error
- func (dc *DockerComposer) RunCommand(service string, cmd string, timeout time.Duration) (retcode int, out string, err error)
- func (dc *DockerComposer) RunCommandAtHosts(cmd, hostSubstring string, timeout time.Duration) error
- func (dc *DockerComposer) Services() []string
- func (dc *DockerComposer) Start(service string) error
- func (dc *DockerComposer) Stop(service string) error
- func (dc *DockerComposer) UnBlockPort(service string, port int) error
- func (dc *DockerComposer) Up(env []string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Composer ¶
type Composer interface { // Brings all containers/VMs up according to config Up(env []string) error // Trears all containers/VMs dowwn Down() error // Returns names/ids of running containers Services() []string // Returns real exposed addr (ip:port) for given service/port GetAddr(service string, port int) (string, error) // Returns internal ip address of given service GetIP(service string) (string, error) // Stops container/VM Stop(service string) error // Starts container/VM Start(service string) error // Detaches container/VM from network DetachFromNet(service string) error // Attaches container/VM to network AttachToNet(service string) error // Blocks port on host BlockPort(service string, port int) error // Unblocks port on host UnBlockPort(service string, port int) error // Executes command inside container/VM with given timeout. // Returns command retcode and output (stdoud and stderr are mixed) RunCommand(service, cmd string, timeout time.Duration) (retcode int, output string, err error) RunCommandAtHosts(cmd, hostsSubstring string, timeout time.Duration) error // Executes command inside container/VM with given timeout. // Returns command retcode and output (stdoud and stderr are mixed) RunAsyncCommand(service, cmd string) error // Returns content of the file from container by path GetFile(service, path string) (io.ReadCloser, error) }
Composer manipulate images/vm's during integration tests
type DockerComposer ¶
type DockerComposer struct {
// contains filtered or unexported fields
}
DockerComposer is a Composer implementation based on docker and docker-compose
func NewDockerComposer ¶
func NewDockerComposer(project, config string) (*DockerComposer, error)
NewDockerComposer returns DockerComposer instance for specified compose file Parameter project specify prefix to distguish docker container and networks from different runs
func (*DockerComposer) AttachToNet ¶
func (dc *DockerComposer) AttachToNet(service string) error
AttachToNet attaches container to network
func (*DockerComposer) BlockPort ¶
func (dc *DockerComposer) BlockPort(service string, port int) error
BlockPort blocks port for host
func (*DockerComposer) DetachFromNet ¶
func (dc *DockerComposer) DetachFromNet(service string) error
DetachFromNet detaches container from network
func (*DockerComposer) Down ¶
func (dc *DockerComposer) Down() error
Down trears all containers/VMs dowwn
func (*DockerComposer) GetAddr ¶
func (dc *DockerComposer) GetAddr(service string, port int) (string, error)
GetAddr returns real exposed addr (ip:port) for given service/port
func (*DockerComposer) GetFile ¶
func (dc *DockerComposer) GetFile(service, path string) (io.ReadCloser, error)
GetFile returns content of the fail from container by path
func (*DockerComposer) GetIP ¶
func (dc *DockerComposer) GetIP(service string) (string, error)
GetIp returns internal ip address of given service
func (*DockerComposer) RunAsyncCommand ¶
func (dc *DockerComposer) RunAsyncCommand(service string, cmd string) error
RunAsyncCommand executes command inside container/VM without waiting for termination.
func (*DockerComposer) RunCommand ¶
func (dc *DockerComposer) RunCommand(service string, cmd string, timeout time.Duration) (retcode int, out string, err error)
RunCommand executes command inside container/VM with given timeout.
func (*DockerComposer) RunCommandAtHosts ¶
func (dc *DockerComposer) RunCommandAtHosts(cmd, hostSubstring string, timeout time.Duration) error
func (*DockerComposer) Services ¶
func (dc *DockerComposer) Services() []string
Services returns names/ids of running containers
func (*DockerComposer) Start ¶
func (dc *DockerComposer) Start(service string) error
Start starts container by service name
func (*DockerComposer) Stop ¶
func (dc *DockerComposer) Stop(service string) error
Stop stops container by service name
func (*DockerComposer) UnBlockPort ¶
func (dc *DockerComposer) UnBlockPort(service string, port int) error
UnBlockPort removes blocking rules for port on host
func (*DockerComposer) Up ¶
func (dc *DockerComposer) Up(env []string) error
Up brings all containers up according to config