Browse code

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>
(cherry picked from commit ead3f4e7c8b7add7beb2de44649b38f41947180f)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2019/09/10 05:38:44
Showing 2 changed files
... ...
@@ -333,7 +333,7 @@ func (s *DockerSwarmSuite) AddDaemon(c *check.C, joinSwarm, manager bool) *daemo
333 333
 			d.StartAndSwarmInit(c)
334 334
 		}
335 335
 	} else {
336
-		d.StartNode(c)
336
+		d.StartNodeWithBusybox(c)
337 337
 	}
338 338
 
339 339
 	s.daemonsLock.Lock()
... ...
@@ -20,12 +20,19 @@ var (
20 20
 	startArgs = []string{"--iptables=false", "--swarm-default-advertise-addr=lo"}
21 21
 )
22 22
 
23
-// StartNode starts daemon to be used as a swarm node
23
+// StartNode (re)starts the daemon
24 24
 func (d *Daemon) StartNode(t testingT) {
25 25
 	if ht, ok := t.(test.HelperT); ok {
26 26
 		ht.Helper()
27 27
 	}
28
-	// avoid networking conflicts
28
+	d.Start(t, startArgs...)
29
+}
30
+
31
+// StartNodeWithBusybox starts daemon to be used as a swarm node, and loads the busybox image
32
+func (d *Daemon) StartNodeWithBusybox(t testingT) {
33
+	if ht, ok := t.(test.HelperT); ok {
34
+		ht.Helper()
35
+	}
29 36
 	d.StartWithBusybox(t, startArgs...)
30 37
 }
31 38
 
... ...
@@ -41,7 +48,7 @@ func (d *Daemon) RestartNode(t testingT) {
41 41
 
42 42
 // StartAndSwarmInit starts the daemon (with busybox) and init the swarm
43 43
 func (d *Daemon) StartAndSwarmInit(t testingT) {
44
-	d.StartNode(t)
44
+	d.StartNodeWithBusybox(t)
45 45
 	d.SwarmInit(t, swarm.InitRequest{})
46 46
 }
47 47
 
... ...
@@ -50,7 +57,7 @@ func (d *Daemon) StartAndSwarmJoin(t testingT, leader *Daemon, manager bool) {
50 50
 	if th, ok := t.(test.HelperT); ok {
51 51
 		th.Helper()
52 52
 	}
53
-	d.StartNode(t)
53
+	d.StartNodeWithBusybox(t)
54 54
 
55 55
 	tokens := leader.JoinTokens(t)
56 56
 	token := tokens.Worker