Browse code

Add ingress nw Test around consition which was panicing

Signed-off-by: Alessandro Boch <aboch@docker.com>

Alessandro Boch authored on 2017/03/31 08:12:48
Showing 1 changed files
... ...
@@ -468,6 +468,24 @@ func (s *DockerSwarmSuite) TestSwarmIngressNetwork(c *check.C) {
468 468
 	c.Assert(err, checker.IsNil, check.Commentf(out))
469 469
 }
470 470
 
471
+func (s *DockerSwarmSuite) TestSwarmCreateServiceWithNoIngressNetwork(c *check.C) {
472
+	d := s.AddDaemon(c, true, true)
473
+
474
+	// Remove ingress network
475
+	out, _, err := testutil.RunCommandPipelineWithOutput(
476
+		exec.Command("echo", "Y"),
477
+		exec.Command("docker", "-H", d.Sock(), "network", "rm", "ingress"),
478
+	)
479
+	c.Assert(err, checker.IsNil, check.Commentf(out))
480
+
481
+	// Create a overlay network and launch a service on it
482
+	// Make sure nothing panics because ingress network is missing
483
+	out, err = d.Cmd("network", "create", "-d", "overlay", "another-network")
484
+	c.Assert(err, checker.IsNil, check.Commentf(out))
485
+	out, err = d.Cmd("service", "create", "--name", "srv4", "--network", "another-network", "busybox", "top")
486
+	c.Assert(err, checker.IsNil, check.Commentf(out))
487
+}
488
+
471 489
 // Test case for #24108, also the case from:
472 490
 // https://github.com/docker/docker/pull/24620#issuecomment-233715656
473 491
 func (s *DockerSwarmSuite) TestSwarmTaskListFilter(c *check.C) {