integration-cli: add daemon.StartNodeWithBusybox function

Starting the daemon should not load the busybox image again
in most cases, so add a new `StartNodeWithBusybox` function
to be clear that this one loads the busybox image, and use
`StartNode()` for cases where loading the busybox image is
not needed.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2019-09-09 22:38:44 +02:00
parent 8fc23588f1
commit ead3f4e7c8
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
2 changed files with 12 additions and 5 deletions

View file

@ -312,7 +312,7 @@ func (s *DockerSwarmSuite) AddDaemon(c *testing.T, joinSwarm, manager bool) *dae
d.StartAndSwarmInit(c)
}
} else {
d.StartNode(c)
d.StartNodeWithBusybox(c)
}
s.daemonsLock.Lock()

View file

@ -20,12 +20,19 @@ var (
startArgs = []string{"--iptables=false", "--swarm-default-advertise-addr=lo"}
)
// StartNode starts daemon to be used as a swarm node
// StartNode (re)starts the daemon
func (d *Daemon) StartNode(t testingT) {
if ht, ok := t.(test.HelperT); ok {
ht.Helper()
}
// avoid networking conflicts
d.Start(t, startArgs...)
}
// StartNodeWithBusybox starts daemon to be used as a swarm node, and loads the busybox image
func (d *Daemon) StartNodeWithBusybox(t testingT) {
if ht, ok := t.(test.HelperT); ok {
ht.Helper()
}
d.StartWithBusybox(t, startArgs...)
}
@ -41,7 +48,7 @@ func (d *Daemon) RestartNode(t testingT) {
// StartAndSwarmInit starts the daemon (with busybox) and init the swarm
func (d *Daemon) StartAndSwarmInit(t testingT) {
d.StartNode(t)
d.StartNodeWithBusybox(t)
d.SwarmInit(t, swarm.InitRequest{})
}
@ -50,7 +57,7 @@ func (d *Daemon) StartAndSwarmJoin(t testingT, leader *Daemon, manager bool) {
if th, ok := t.(test.HelperT); ok {
th.Helper()
}
d.StartNode(t)
d.StartNodeWithBusybox(t)
tokens := leader.JoinTokens(t)
token := tokens.Worker