From 73e6135458cfa09171526467b41b18890dc8b3d3 Mon Sep 17 00:00:00 2001 From: Daniel Nephin Date: Fri, 24 Mar 2017 15:31:08 -0400 Subject: [PATCH] Fix flaky TestStackRemove test. Signed-off-by: Daniel Nephin --- integration-cli/docker_cli_stack_test.go | 27 +++++++++++++-------- integration-cli/fixtures/deploy/remove.yaml | 2 +- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/integration-cli/docker_cli_stack_test.go b/integration-cli/docker_cli_stack_test.go index 6428ed14b6..d754a2c77a 100644 --- a/integration-cli/docker_cli_stack_test.go +++ b/integration-cli/docker_cli_stack_test.go @@ -11,6 +11,7 @@ import ( "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/integration-cli/checker" + icmd "github.com/docker/docker/pkg/testutil/cmd" "github.com/go-check/check" ) @@ -111,18 +112,24 @@ func (s *DockerSwarmSuite) TestStackRemove(c *check.C) { "--compose-file", "fixtures/deploy/remove.yaml", stackName, } - out, err := d.Cmd(stackArgs...) - c.Assert(err, checker.IsNil, check.Commentf(out)) + result := icmd.RunCmd(d.Command(stackArgs...)) + result.Assert(c, icmd.Expected{ + Err: icmd.None, + Out: "Creating service testdeploy_web", + }) - out, err = d.Cmd("stack", "ps", stackName) - c.Assert(err, checker.IsNil) - c.Assert(strings.Split(strings.TrimSpace(out), "\n"), checker.HasLen, 2) + result = icmd.RunCmd(d.Command("service", "ls")) + result.Assert(c, icmd.Success) + c.Assert( + strings.Split(strings.TrimSpace(result.Stdout()), "\n"), + checker.HasLen, 2) - out, err = d.Cmd("stack", "rm", stackName) - c.Assert(err, checker.IsNil, check.Commentf(out)) - c.Assert(out, checker.Contains, "Removing service testdeploy_web") - c.Assert(out, checker.Contains, "Removing network testdeploy_default") - c.Assert(out, checker.Contains, "Removing secret testdeploy_special") + result = icmd.RunCmd(d.Command("stack", "rm", stackName)) + result.Assert(c, icmd.Success) + stderr := result.Stderr() + c.Assert(stderr, checker.Contains, "Removing service testdeploy_web") + c.Assert(stderr, checker.Contains, "Removing network testdeploy_default") + c.Assert(stderr, checker.Contains, "Removing secret testdeploy_special") } type sortSecrets []swarm.SecretReference diff --git a/integration-cli/fixtures/deploy/remove.yaml b/integration-cli/fixtures/deploy/remove.yaml index 4ec8cacc9b..4337581bf8 100644 --- a/integration-cli/fixtures/deploy/remove.yaml +++ b/integration-cli/fixtures/deploy/remove.yaml @@ -2,7 +2,7 @@ version: "3.1" services: web: - image: busybox@sha256:e4f93f6ed15a0cdd342f5aae387886fba0ab98af0a102da6276eaf24d6e6ade0 + image: busybox:latest command: top secrets: - special