From bff9e0001ad563c60cb67849a53651427ac584c2 Mon Sep 17 00:00:00 2001 From: Alessandro Boch Date: Thu, 30 Mar 2017 16:12:48 -0700 Subject: [PATCH] Add ingress nw Test around consition which was panicing Signed-off-by: Alessandro Boch Upstream-commit: 4777fb6c6b1783de01d3dbeacc2d1af33f3fabc2 Component: engine --- .../integration-cli/docker_cli_swarm_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/components/engine/integration-cli/docker_cli_swarm_test.go b/components/engine/integration-cli/docker_cli_swarm_test.go index b73ab07898..35582fbd31 100644 --- a/components/engine/integration-cli/docker_cli_swarm_test.go +++ b/components/engine/integration-cli/docker_cli_swarm_test.go @@ -468,6 +468,24 @@ func (s *DockerSwarmSuite) TestSwarmIngressNetwork(c *check.C) { c.Assert(err, checker.IsNil, check.Commentf(out)) } +func (s *DockerSwarmSuite) TestSwarmCreateServiceWithNoIngressNetwork(c *check.C) { + d := s.AddDaemon(c, true, true) + + // Remove ingress network + out, _, err := testutil.RunCommandPipelineWithOutput( + exec.Command("echo", "Y"), + exec.Command("docker", "-H", d.Sock(), "network", "rm", "ingress"), + ) + c.Assert(err, checker.IsNil, check.Commentf(out)) + + // Create a overlay network and launch a service on it + // Make sure nothing panics because ingress network is missing + out, err = d.Cmd("network", "create", "-d", "overlay", "another-network") + c.Assert(err, checker.IsNil, check.Commentf(out)) + out, err = d.Cmd("service", "create", "--name", "srv4", "--network", "another-network", "busybox", "top") + c.Assert(err, checker.IsNil, check.Commentf(out)) +} + // Test case for #24108, also the case from: // https://github.com/docker/docker/pull/24620#issuecomment-233715656 func (s *DockerSwarmSuite) TestSwarmTaskListFilter(c *check.C) {