Browse Source

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>
Sebastiaan van Stijn 5 năm trước cách đây
mục cha
commit
ead3f4e7c8

+ 1 - 1
integration-cli/check_test.go

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

+ 11 - 4
internal/test/daemon/swarm.go

@@ -20,12 +20,19 @@ var (
 	startArgs = []string{"--iptables=false", "--swarm-default-advertise-addr=lo"}
 	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) {
 func (d *Daemon) StartNode(t testingT) {
 	if ht, ok := t.(test.HelperT); ok {
 	if ht, ok := t.(test.HelperT); ok {
 		ht.Helper()
 		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...)
 	d.StartWithBusybox(t, startArgs...)
 }
 }
 
 
@@ -41,7 +48,7 @@ func (d *Daemon) RestartNode(t testingT) {
 
 
 // StartAndSwarmInit starts the daemon (with busybox) and init the swarm
 // StartAndSwarmInit starts the daemon (with busybox) and init the swarm
 func (d *Daemon) StartAndSwarmInit(t testingT) {
 func (d *Daemon) StartAndSwarmInit(t testingT) {
-	d.StartNode(t)
+	d.StartNodeWithBusybox(t)
 	d.SwarmInit(t, swarm.InitRequest{})
 	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 {
 	if th, ok := t.(test.HelperT); ok {
 		th.Helper()
 		th.Helper()
 	}
 	}
-	d.StartNode(t)
+	d.StartNodeWithBusybox(t)
 
 
 	tokens := leader.JoinTokens(t)
 	tokens := leader.JoinTokens(t)
 	token := tokens.Worker
 	token := tokens.Worker