Documentation ¶
Index ¶
- Constants
- Variables
- func SignalDaemonDump(pid int)
- func WithDockerdBinary(dockerdBinary string) func(*Daemon)
- func WithEnvironment(e environment.Execution) func(*Daemon)
- func WithExperimental(d *Daemon)
- func WithInit(d *Daemon)
- func WithSwarmListenAddr(listenAddr string) func(*Daemon)
- func WithSwarmPort(port int) func(*Daemon)
- type ConfigConstructor
- type Daemon
- func (d *Daemon) ActiveContainers(t assert.TestingT) []string
- func (d *Daemon) Cleanup(t testingT)
- func (d *Daemon) CreateConfig(t assert.TestingT, configSpec swarm.ConfigSpec) string
- func (d *Daemon) CreateSecret(t assert.TestingT, secretSpec swarm.SecretSpec) string
- func (d *Daemon) CreateService(t assert.TestingT, f ...ServiceConstructor) string
- func (d *Daemon) DeleteConfig(t assert.TestingT, id string)
- func (d *Daemon) DeleteSecret(t assert.TestingT, id string)
- func (d *Daemon) DumpStackAndQuit()
- func (d *Daemon) FindContainerIP(t assert.TestingT, id string) string
- func (d *Daemon) GetConfig(t assert.TestingT, id string) *swarm.Config
- func (d *Daemon) GetNode(t assert.TestingT, id string) *swarm.Node
- func (d *Daemon) GetSecret(t assert.TestingT, id string) *swarm.Secret
- func (d *Daemon) GetService(t assert.TestingT, id string) *swarm.Service
- func (d *Daemon) GetServiceTasks(t assert.TestingT, service string) []swarm.Task
- func (d *Daemon) GetSwarm(t assert.TestingT) swarm.Swarm
- func (d *Daemon) GetTask(t assert.TestingT, id string) swarm.Task
- func (d *Daemon) ID() string
- func (d *Daemon) Info(t assert.TestingT) types.Info
- func (d *Daemon) Interrupt() error
- func (d *Daemon) JoinTokens(t assert.TestingT) swarm.JoinTokens
- func (d *Daemon) Kill() error
- func (d *Daemon) ListConfigs(t assert.TestingT) []swarm.Config
- func (d *Daemon) ListNodes(t assert.TestingT) []swarm.Node
- func (d *Daemon) ListSecrets(t assert.TestingT) []swarm.Secret
- func (d *Daemon) ListServices(t assert.TestingT) []swarm.Service
- func (d *Daemon) LoadBusybox(t assert.TestingT)
- func (d *Daemon) LogFileName() string
- func (d *Daemon) NewClient() (*client.Client, error)
- func (d *Daemon) NewClientT(t assert.TestingT) *client.Client
- func (d *Daemon) NodeID() string
- func (d *Daemon) Pid() int
- func (d *Daemon) PluginIsNotPresent(name string) func(poll.LogT) poll.Result
- func (d *Daemon) PluginIsNotRunning(name string) func(poll.LogT) poll.Result
- func (d *Daemon) PluginIsRunning(name string) func(poll.LogT) poll.Result
- func (d *Daemon) PluginReferenceIs(name, expectedRef string) func(poll.LogT) poll.Result
- func (d *Daemon) ReadLogFile() ([]byte, error)
- func (d *Daemon) ReloadConfig() error
- func (d *Daemon) RemoveNode(t assert.TestingT, id string, force bool)
- func (d *Daemon) RemoveService(t assert.TestingT, id string)
- func (d *Daemon) Restart(t testingT, args ...string)
- func (d *Daemon) RestartWithError(arg ...string) error
- func (d *Daemon) RootDir() string
- func (d *Daemon) RotateTokens(t assert.TestingT)
- func (d *Daemon) Signal(signal os.Signal) error
- func (d *Daemon) Sock() string
- func (d *Daemon) Start(t testingT, args ...string)
- func (d *Daemon) StartAndSwarmInit(t testingT)
- func (d *Daemon) StartAndSwarmJoin(t testingT, leader *Daemon, manager bool)
- 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) SwarmInfo(t assert.TestingT) swarm.Info
- func (d *Daemon) SwarmInit(t assert.TestingT, req swarm.InitRequest)
- func (d *Daemon) SwarmJoin(t assert.TestingT, req swarm.JoinRequest)
- func (d *Daemon) SwarmLeave(force bool) error
- func (d *Daemon) SwarmListenAddr() string
- func (d *Daemon) SwarmUnlock(req swarm.UnlockRequest) error
- func (d *Daemon) UpdateConfig(t assert.TestingT, id string, f ...ConfigConstructor)
- func (d *Daemon) UpdateNode(t assert.TestingT, id string, f ...NodeConstructor)
- func (d *Daemon) UpdateSecret(t assert.TestingT, id string, f ...SecretConstructor)
- func (d *Daemon) UpdateService(t assert.TestingT, service *swarm.Service, f ...ServiceConstructor)
- func (d *Daemon) UpdateSwarm(t assert.TestingT, f ...SpecConstructor)
- type NodeConstructor
- type SecretConstructor
- type ServiceConstructor
- type SpecConstructor
Constants ¶
const (
// DefaultSwarmPort is the default port use for swarm in the tests
DefaultSwarmPort = 2477
)
Variables ¶
var SockRoot = filepath.Join(os.TempDir(), "docker-integration")
SockRoot holds the path of the default docker integration daemon socket
Functions ¶
func SignalDaemonDump ¶
func SignalDaemonDump(pid int)
SignalDaemonDump sends a signal to the daemon to write a dump file
func WithDockerdBinary ¶
WithDockerdBinary sets the dockerd binary to the specified one
func WithEnvironment ¶
func WithEnvironment(e environment.Execution) func(*Daemon)
WithEnvironment sets options from internal/test/environment.Execution struct
func WithExperimental ¶
func WithExperimental(d *Daemon)
WithExperimental sets the daemon in experimental mode
func WithSwarmListenAddr ¶
WithSwarmListenAddr sets the swarm listen addr to use for swarm mode
func WithSwarmPort ¶
WithSwarmPort sets the swarm port to use for swarm mode
Types ¶
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 SwarmPort int // FIXME(vdemeester) should probably not be exported // cached information CachedInfo types.Info // 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) Cleanup ¶
func (d *Daemon) Cleanup(t testingT)
Cleanup cleans the daemon files : exec root (network namespaces, ...), swarmkit files
func (*Daemon) CreateConfig ¶
CreateConfig creates a config given the specified spec
func (*Daemon) CreateSecret ¶
CreateSecret creates a secret given the specified spec
func (*Daemon) CreateService ¶
func (d *Daemon) CreateService(t assert.TestingT, f ...ServiceConstructor) string
CreateService creates a swarm service given the specified service constructor
func (*Daemon) DeleteConfig ¶
DeleteConfig removes the swarm config identified by the specified id
func (*Daemon) DeleteSecret ¶
DeleteSecret removes the swarm secret identified by the specified id
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) GetService ¶
GetService returns the swarm service corresponding to the specified id
func (*Daemon) GetServiceTasks ¶
GetServiceTasks returns the swarm tasks for the specified service
func (*Daemon) JoinTokens ¶
func (d *Daemon) JoinTokens(t assert.TestingT) swarm.JoinTokens
JoinTokens returns the current swarm join tokens
func (*Daemon) ListConfigs ¶
ListConfigs returns the list of the current swarm configs
func (*Daemon) ListSecrets ¶
ListSecrets returns the list of the current swarm secrets
func (*Daemon) ListServices ¶
ListServices returns the list of the current swarm services
func (*Daemon) LoadBusybox ¶
LoadBusybox image into the daemon
func (*Daemon) LogFileName ¶
LogFileName returns the path the daemon's log file
func (*Daemon) NewClient ¶
NewClient creates new client based on daemon's socket path FIXME(vdemeester): replace NewClient with NewClientT
func (*Daemon) NewClientT ¶
NewClientT creates new client based on daemon's socket path FIXME(vdemeester): replace NewClient with NewClientT
func (*Daemon) PluginIsNotPresent ¶
PluginIsNotPresent provides a poller to check if the specified plugin is not present
func (*Daemon) PluginIsNotRunning ¶
PluginIsNotRunning provides a poller to check if the specified plugin is not running
func (*Daemon) PluginIsRunning ¶
PluginIsRunning provides a poller to check if the specified plugin is running
func (*Daemon) PluginReferenceIs ¶
PluginReferenceIs provides a poller to check if the specified plugin has the specified reference
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) RemoveNode ¶
RemoveNode removes the specified node
func (*Daemon) RemoveService ¶
RemoveService removes the specified service
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) RotateTokens ¶
RotateTokens update the swarm to rotate tokens
func (*Daemon) StartAndSwarmInit ¶
func (d *Daemon) StartAndSwarmInit(t testingT)
StartAndSwarmInit starts the daemon (with busybox) and init the swarm
func (*Daemon) StartAndSwarmJoin ¶
StartAndSwarmJoin starts the daemon (with busybox) and join the specified swarm as worker or manager
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
func (*Daemon) SwarmInit ¶
func (d *Daemon) SwarmInit(t assert.TestingT, req swarm.InitRequest)
SwarmInit initializes a new swarm cluster.
func (*Daemon) SwarmJoin ¶
func (d *Daemon) SwarmJoin(t assert.TestingT, req swarm.JoinRequest)
SwarmJoin joins a daemon to an existing cluster.
func (*Daemon) SwarmLeave ¶
SwarmLeave forces daemon to leave current cluster.
func (*Daemon) SwarmListenAddr ¶
SwarmListenAddr returns the listen-addr used for the daemon
func (*Daemon) SwarmUnlock ¶
func (d *Daemon) SwarmUnlock(req swarm.UnlockRequest) error
SwarmUnlock tries to unlock a locked swarm
func (*Daemon) UpdateConfig ¶
func (d *Daemon) UpdateConfig(t assert.TestingT, id string, f ...ConfigConstructor)
UpdateConfig updates the swarm config identified by the specified id Currently, only label update is supported.
func (*Daemon) UpdateNode ¶
func (d *Daemon) UpdateNode(t assert.TestingT, id string, f ...NodeConstructor)
UpdateNode updates a swarm node with the specified node constructor
func (*Daemon) UpdateSecret ¶
func (d *Daemon) UpdateSecret(t assert.TestingT, id string, f ...SecretConstructor)
UpdateSecret updates the swarm secret identified by the specified id Currently, only label update is supported.
func (*Daemon) UpdateService ¶
UpdateService updates a swarm service with the specified service constructor
func (*Daemon) UpdateSwarm ¶
func (d *Daemon) UpdateSwarm(t assert.TestingT, f ...SpecConstructor)
UpdateSwarm updates the current swarm object with the specified spec constructors
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