Documentation ¶
Index ¶
- Variables
- func BuildImageCmdWithHost(dockerBinary, name, dockerfile, host string, useCache bool, ...) *exec.Cmd
- func SignalDaemonDump(pid int)
- func WaitInspectWithArgs(dockerBinary, name, expr, expected string, timeout time.Duration, ...) error
- type Config
- type ConfigConstructor
- type Daemon
- func (d *Daemon) ActiveContainers() (ids []string)
- func (d *Daemon) BuildImageWithOut(name, dockerfile string, useCache bool, buildFlags ...string) (string, int, error)
- func (d *Daemon) CheckActiveContainerCount(c *check.C) (interface{}, check.CommentInterface)
- func (d *Daemon) CleanupExecRoot(c *check.C)
- func (d *Daemon) Cmd(args ...string) (string, error)
- func (d *Daemon) Command(args ...string) icmd.Cmd
- func (d *Daemon) DumpStackAndQuit()
- func (d *Daemon) FindContainerIP(id string) (string, error)
- func (d *Daemon) GetIDByName(name string) (string, error)
- func (d *Daemon) ID() string
- func (d *Daemon) Info(t require.TestingT) types.Info
- func (d *Daemon) InspectField(name, filter string) (string, error)
- func (d *Daemon) Interrupt() error
- func (d *Daemon) Kill() error
- func (d *Daemon) LoadBusybox(t testingT)
- func (d *Daemon) LogFileName() string
- func (d *Daemon) NewClient() (*client.Client, error)
- func (d *Daemon) Pid() int
- func (d *Daemon) PrependHostArg(args []string) []string
- func (d *Daemon) ReadLogFile() ([]byte, error)
- func (d *Daemon) ReloadConfig() error
- func (d *Daemon) Restart(t testingT, args ...string)
- func (d *Daemon) RestartWithError(arg ...string) error
- func (d *Daemon) RootDir() string
- func (d *Daemon) Signal(signal os.Signal) error
- func (d *Daemon) Sock() string
- func (d *Daemon) SockRequest(method, endpoint string, data interface{}) (int, []byte, error)
- func (d *Daemon) SockRequestRaw(method, endpoint string, data io.Reader, ct string) (*http.Response, io.ReadCloser, error)
- func (d *Daemon) Start(t testingT, args ...string)
- func (d *Daemon) StartWithBusybox(t testingT, arg ...string)
- func (d *Daemon) StartWithError(args ...string) error
- func (d *Daemon) StartWithLogFile(out *os.File, providedArgs ...string) error
- func (d *Daemon) Stop(t testingT)
- func (d *Daemon) StopWithError() error
- func (d *Daemon) StorageDriver() string
- func (d *Daemon) WaitRun(contID string) error
- type NodeConstructor
- type SecretConstructor
- type ServiceConstructor
- type SpecConstructor
- type Swarm
- func (d *Swarm) CheckControlAvailable(c *check.C) (interface{}, check.CommentInterface)
- func (d *Swarm) CheckLeader(c *check.C) (interface{}, check.CommentInterface)
- func (d *Swarm) CheckLocalNodeState(c *check.C) (interface{}, check.CommentInterface)
- func (d *Swarm) CheckNodeReadyCount(c *check.C) (interface{}, check.CommentInterface)
- func (d *Swarm) CheckPluginImage(plugin string) func(c *check.C) (interface{}, check.CommentInterface)
- func (d *Swarm) CheckPluginRunning(plugin string) func(c *check.C) (interface{}, check.CommentInterface)
- func (d *Swarm) CheckRunningTaskImages(c *check.C) (interface{}, check.CommentInterface)
- func (d *Swarm) CheckRunningTaskNetworks(c *check.C) (interface{}, check.CommentInterface)
- func (d *Swarm) CheckServiceRunningTasks(service string) func(*check.C) (interface{}, check.CommentInterface)
- func (d *Swarm) CheckServiceTasks(service string) func(*check.C) (interface{}, check.CommentInterface)
- func (d *Swarm) CheckServiceTasksInState(service string, state swarm.TaskState, message string) func(*check.C) (interface{}, check.CommentInterface)
- func (d *Swarm) CheckServiceTasksInStateWithError(service string, state swarm.TaskState, errorMessage string) func(*check.C) (interface{}, check.CommentInterface)
- func (d *Swarm) CheckServiceUpdateState(service string) func(*check.C) (interface{}, check.CommentInterface)
- func (d *Swarm) CmdRetryOutOfSequence(args ...string) (string, error)
- func (d *Swarm) CreateConfig(c *check.C, configSpec swarm.ConfigSpec) string
- func (d *Swarm) CreateSecret(c *check.C, secretSpec swarm.SecretSpec) string
- func (d *Swarm) CreateService(c *check.C, f ...ServiceConstructor) string
- func (d *Swarm) CreateServiceWithOptions(c *check.C, opts types.ServiceCreateOptions, f ...ServiceConstructor) string
- func (d *Swarm) DeleteConfig(c *check.C, id string)
- func (d *Swarm) DeleteSecret(c *check.C, id string)
- func (d *Swarm) GetConfig(c *check.C, id string) *swarm.Config
- func (d *Swarm) GetNode(c *check.C, id string) *swarm.Node
- func (d *Swarm) GetSecret(c *check.C, id string) *swarm.Secret
- func (d *Swarm) GetService(c *check.C, id string) *swarm.Service
- func (d *Swarm) GetServiceTasks(c *check.C, service string) []swarm.Task
- func (d *Swarm) GetSwarm(c *check.C) swarm.Swarm
- func (d *Swarm) GetTask(c *check.C, id string) swarm.Task
- func (d *Swarm) Init(req swarm.InitRequest) error
- func (d *Swarm) Join(req swarm.JoinRequest) error
- func (d *Swarm) JoinTokens(c *check.C) swarm.JoinTokens
- func (d *Swarm) Leave(force bool) error
- func (d *Swarm) ListConfigs(c *check.C) []swarm.Config
- func (d *Swarm) ListNodes(c *check.C) []swarm.Node
- func (d *Swarm) ListSecrets(c *check.C) []swarm.Secret
- func (d *Swarm) ListServices(c *check.C) []swarm.Service
- func (d *Swarm) RemoveNode(c *check.C, id string, force bool)
- func (d *Swarm) RemoveService(c *check.C, id string)
- func (d *Swarm) RotateTokens(c *check.C)
- func (d *Swarm) SwarmInfo() (swarm.Info, error)
- func (d *Swarm) Unlock(req swarm.UnlockRequest) error
- func (d *Swarm) UpdateConfig(c *check.C, id string, f ...ConfigConstructor)
- func (d *Swarm) UpdateNode(c *check.C, id string, f ...NodeConstructor)
- func (d *Swarm) UpdateSecret(c *check.C, id string, f ...SecretConstructor)
- func (d *Swarm) UpdateService(c *check.C, service *swarm.Service, f ...ServiceConstructor)
- func (d *Swarm) UpdateSwarm(c *check.C, f ...SpecConstructor)
Constants ¶
This section is empty.
Variables ¶
var SockRoot = filepath.Join(os.TempDir(), "docker-integration")
SockRoot holds the path of the default docker integration daemon socket
Functions ¶
func BuildImageCmdWithHost ¶
func BuildImageCmdWithHost(dockerBinary, name, dockerfile, host string, useCache bool, buildFlags ...string) *exec.Cmd
BuildImageCmdWithHost create a build command with the specified arguments. Deprecated FIXME(vdemeester) move this away
func SignalDaemonDump ¶
func SignalDaemonDump(pid int)
SignalDaemonDump sends a signal to the daemon to write a dump file
Types ¶
type Config ¶
type Config struct {
Experimental bool
}
Config holds docker daemon integration configuration
type ConfigConstructor ¶
ConfigConstructor defines a swarm config constructor
type Daemon ¶
type Daemon struct { GlobalFlags []string Root string Folder string Wait chan error UseDefaultHost bool UseDefaultTLSHost bool // contains filtered or unexported fields }
Daemon represents a Docker daemon for the testing framework.
func New ¶
New returns a Daemon instance to be used for testing. This will create a directory such as d123456789 in the folder specified by $DOCKER_INTEGRATION_DAEMON_DEST or $DEST. The daemon will not automatically start.
func (*Daemon) ActiveContainers ¶
ActiveContainers returns the list of ids of the currently running containers
func (*Daemon) BuildImageWithOut ¶
func (d *Daemon) BuildImageWithOut(name, dockerfile string, useCache bool, buildFlags ...string) (string, int, error)
BuildImageWithOut builds an image with the specified dockerfile and options and returns the output
func (*Daemon) CheckActiveContainerCount ¶
func (d *Daemon) CheckActiveContainerCount(c *check.C) (interface{}, check.CommentInterface)
CheckActiveContainerCount returns the number of active containers FIXME(vdemeester) should re-use ActivateContainers in some way
func (*Daemon) CleanupExecRoot ¶
CleanupExecRoot cleans the daemon exec root (network namespaces, ...)
func (*Daemon) Cmd ¶
Cmd executes a docker CLI command against this daemon. Example: d.Cmd("version") will run docker -H unix://path/to/unix.sock version
func (*Daemon) Command ¶
Command creates a docker CLI command against this daemon, to be executed later. Example: d.Command("version") creates a command to run "docker -H unix://path/to/unix.sock version"
func (*Daemon) DumpStackAndQuit ¶
func (d *Daemon) DumpStackAndQuit()
DumpStackAndQuit sends SIGQUIT to the daemon, which triggers it to dump its stack to its log file and exit This is used primarily for gathering debug information on test timeout
func (*Daemon) FindContainerIP ¶
FindContainerIP returns the ip of the specified container
func (*Daemon) GetIDByName ¶
GetIDByName returns the ID of an object (container, volume, …) given its name
func (*Daemon) InspectField ¶
InspectField returns the field filter by 'filter'
func (*Daemon) LoadBusybox ¶
func (d *Daemon) LoadBusybox(t testingT)
LoadBusybox image into the daemon
func (*Daemon) LogFileName ¶
LogFileName returns the path the daemon's log file
func (*Daemon) PrependHostArg ¶
PrependHostArg prepend the specified arguments by the daemon host flags
func (*Daemon) ReadLogFile ¶
ReadLogFile returns the content of the daemon log file
func (*Daemon) ReloadConfig ¶
ReloadConfig asks the daemon to reload its configuration
func (*Daemon) Restart ¶
Restart will restart the daemon by first stopping it and the starting it. If an error occurs while starting the daemon, the test will fail.
func (*Daemon) RestartWithError ¶
RestartWithError will restart the daemon by first stopping it and then starting it.
func (*Daemon) SockRequest ¶
SockRequest executes a socket request on a daemon and returns statuscode and output.
func (*Daemon) SockRequestRaw ¶
func (d *Daemon) SockRequestRaw(method, endpoint string, data io.Reader, ct string) (*http.Response, io.ReadCloser, error)
SockRequestRaw executes a socket request on a daemon and returns an http response and a reader for the output data. Deprecated: use request package instead
func (*Daemon) StartWithBusybox ¶
StartWithBusybox will first start the daemon with Daemon.Start() then save the busybox image from the main daemon and load it into this Daemon instance.
func (*Daemon) StartWithError ¶
StartWithError starts the daemon and return once it is ready to receive requests. It returns an error in case it couldn't start.
func (*Daemon) StartWithLogFile ¶
StartWithLogFile will start the daemon and attach its streams to a given file.
func (*Daemon) Stop ¶
func (d *Daemon) Stop(t testingT)
Stop will send a SIGINT every second and wait for the daemon to stop. If it times out, a SIGKILL is sent. Stop will not delete the daemon directory. If a purged daemon is needed, instantiate a new one with NewDaemon. If an error occurs while starting the daemon, the test will fail.
func (*Daemon) StopWithError ¶
StopWithError will send a SIGINT every second and wait for the daemon to stop. If it timeouts, a SIGKILL is sent. Stop will not delete the daemon directory. If a purged daemon is needed, instantiate a new one with NewDaemon.
func (*Daemon) StorageDriver ¶
StorageDriver returns the configured storage driver of the daemon
type NodeConstructor ¶
NodeConstructor defines a swarm node constructor
type SecretConstructor ¶
SecretConstructor defines a swarm secret constructor
type ServiceConstructor ¶
ServiceConstructor defines a swarm service constructor function
type SpecConstructor ¶
SpecConstructor defines a swarm spec constructor
type Swarm ¶
Swarm is a test daemon with helpers for participating in a swarm.
func (*Swarm) CheckControlAvailable ¶
func (d *Swarm) CheckControlAvailable(c *check.C) (interface{}, check.CommentInterface)
CheckControlAvailable returns the current swarm control available
func (*Swarm) CheckLeader ¶
func (d *Swarm) CheckLeader(c *check.C) (interface{}, check.CommentInterface)
CheckLeader returns whether there is a leader on the swarm or not
func (*Swarm) CheckLocalNodeState ¶
func (d *Swarm) CheckLocalNodeState(c *check.C) (interface{}, check.CommentInterface)
CheckLocalNodeState returns the current swarm node state
func (*Swarm) CheckNodeReadyCount ¶
func (d *Swarm) CheckNodeReadyCount(c *check.C) (interface{}, check.CommentInterface)
CheckNodeReadyCount returns the number of ready node on the swarm
func (*Swarm) CheckPluginImage ¶
func (d *Swarm) CheckPluginImage(plugin string) func(c *check.C) (interface{}, check.CommentInterface)
CheckPluginImage returns the runtime state of the plugin
func (*Swarm) CheckPluginRunning ¶
func (d *Swarm) CheckPluginRunning(plugin string) func(c *check.C) (interface{}, check.CommentInterface)
CheckPluginRunning returns the runtime state of the plugin
func (*Swarm) CheckRunningTaskImages ¶
func (d *Swarm) CheckRunningTaskImages(c *check.C) (interface{}, check.CommentInterface)
CheckRunningTaskImages returns the times each image is running as a task.
func (*Swarm) CheckRunningTaskNetworks ¶
func (d *Swarm) CheckRunningTaskNetworks(c *check.C) (interface{}, check.CommentInterface)
CheckRunningTaskNetworks returns the number of times each network is referenced from a task.
func (*Swarm) CheckServiceRunningTasks ¶
func (d *Swarm) CheckServiceRunningTasks(service string) func(*check.C) (interface{}, check.CommentInterface)
CheckServiceRunningTasks returns the number of running tasks for the specified service
func (*Swarm) CheckServiceTasks ¶
func (d *Swarm) CheckServiceTasks(service string) func(*check.C) (interface{}, check.CommentInterface)
CheckServiceTasks returns the number of tasks for the specified service
func (*Swarm) CheckServiceTasksInState ¶
func (d *Swarm) CheckServiceTasksInState(service string, state swarm.TaskState, message string) func(*check.C) (interface{}, check.CommentInterface)
CheckServiceTasksInState returns the number of tasks with a matching state, and optional message substring.
func (*Swarm) CheckServiceTasksInStateWithError ¶
func (d *Swarm) CheckServiceTasksInStateWithError(service string, state swarm.TaskState, errorMessage string) func(*check.C) (interface{}, check.CommentInterface)
CheckServiceTasksInStateWithError returns the number of tasks with a matching state, and optional message substring.
func (*Swarm) CheckServiceUpdateState ¶
func (d *Swarm) CheckServiceUpdateState(service string) func(*check.C) (interface{}, check.CommentInterface)
CheckServiceUpdateState returns the current update state for the specified service
func (*Swarm) CmdRetryOutOfSequence ¶
CmdRetryOutOfSequence tries the specified command against the current daemon for 10 times
func (*Swarm) CreateConfig ¶
CreateConfig creates a config given the specified spec
func (*Swarm) CreateSecret ¶
CreateSecret creates a secret given the specified spec
func (*Swarm) CreateService ¶
func (d *Swarm) CreateService(c *check.C, f ...ServiceConstructor) string
CreateService creates a swarm service given the specified service constructor
func (*Swarm) CreateServiceWithOptions ¶
func (d *Swarm) CreateServiceWithOptions(c *check.C, opts types.ServiceCreateOptions, f ...ServiceConstructor) string
CreateServiceWithOptions creates a swarm service given the specified service constructors and auth config
func (*Swarm) DeleteConfig ¶
DeleteConfig removes the swarm config identified by the specified id
func (*Swarm) DeleteSecret ¶
DeleteSecret removes the swarm secret identified by the specified id
func (*Swarm) GetService ¶
GetService returns the swarm service corresponding to the specified id
func (*Swarm) GetServiceTasks ¶
GetServiceTasks returns the swarm tasks for the specified service
func (*Swarm) Init ¶
func (d *Swarm) Init(req swarm.InitRequest) error
Init initializes a new swarm cluster.
func (*Swarm) Join ¶
func (d *Swarm) Join(req swarm.JoinRequest) error
Join joins a daemon to an existing cluster.
func (*Swarm) JoinTokens ¶
func (d *Swarm) JoinTokens(c *check.C) swarm.JoinTokens
JoinTokens returns the current swarm join tokens
func (*Swarm) ListConfigs ¶
ListConfigs returns the list of the current swarm configs
func (*Swarm) ListSecrets ¶
ListSecrets returns the list of the current swarm secrets
func (*Swarm) ListServices ¶
ListServices returns the list of the current swarm services
func (*Swarm) RemoveNode ¶
RemoveNode removes the specified node
func (*Swarm) RemoveService ¶
RemoveService removes the specified service
func (*Swarm) RotateTokens ¶
RotateTokens update the swarm to rotate tokens
func (*Swarm) Unlock ¶
func (d *Swarm) Unlock(req swarm.UnlockRequest) error
Unlock tries to unlock a locked swarm
func (*Swarm) UpdateConfig ¶
func (d *Swarm) UpdateConfig(c *check.C, id string, f ...ConfigConstructor)
UpdateConfig updates the swarm config identified by the specified id Currently, only label update is supported.
func (*Swarm) UpdateNode ¶
func (d *Swarm) UpdateNode(c *check.C, id string, f ...NodeConstructor)
UpdateNode updates a swarm node with the specified node constructor
func (*Swarm) UpdateSecret ¶
func (d *Swarm) UpdateSecret(c *check.C, id string, f ...SecretConstructor)
UpdateSecret updates the swarm secret identified by the specified id Currently, only label update is supported.
func (*Swarm) UpdateService ¶
UpdateService updates a swarm service with the specified service constructor
func (*Swarm) UpdateSwarm ¶
func (d *Swarm) UpdateSwarm(c *check.C, f ...SpecConstructor)
UpdateSwarm updates the current swarm object with the specified spec constructors