Fix flaky TestStackRemove test.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
Daniel Nephin 2017-03-24 15:31:08 -04:00
parent b86efd2707
commit 73e6135458
2 changed files with 18 additions and 11 deletions

View file

@ -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

View file

@ -2,7 +2,7 @@
version: "3.1"
services:
web:
image: busybox@sha256:e4f93f6ed15a0cdd342f5aae387886fba0ab98af0a102da6276eaf24d6e6ade0
image: busybox:latest
command: top
secrets:
- special