diff options
| author | Yong Tang <yong.tang.github@outlook.com> | 2016-03-16 03:10:49 +0000 |
|---|---|---|
| committer | Yong Tang <yong.tang.github@outlook.com> | 2016-03-18 05:50:23 +0000 |
| commit | 48ccdd46aea4bb16925d0a333f792a712f1c11dc (patch) | |
| tree | ab8b471cc25d6512de3f6b85895149761bdd8e31 /integration-cli/docker_cli_restart_test.go | |
| parent | 46dde68158c851da0bdd8dc22342d35609a19a61 (diff) | |
| download | docker-48ccdd46aea4bb16925d0a333f792a712f1c11dc.tar.gz | |
Fix flaky test of TestRestartStoppedContainer (#21211).
This fix addressed the issue of test TestRestartStoppedContainer
in #21211. Inside the test, a `docker restart` command is
followed by a `docker logs` command. However, `docker restart`
returns immediately so there is no guarantee that `docker logs`
will wait until the restarted container completes the command
`echo foobar`.
This fix use the check of `{{.State.Running}} = false` to make
sure that the restarted container has already finished, before
invoking the `docker logs` command. The timeout is set to 20s
to make sure it passes WindowsTP4 check.
This fixes #21211.
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Diffstat (limited to 'integration-cli/docker_cli_restart_test.go')
| -rw-r--r-- | integration-cli/docker_cli_restart_test.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/integration-cli/docker_cli_restart_test.go b/integration-cli/docker_cli_restart_test.go index 2de3d12d93..297e16a169 100644 --- a/integration-cli/docker_cli_restart_test.go +++ b/integration-cli/docker_cli_restart_test.go @@ -20,6 +20,10 @@ func (s *DockerSuite) TestRestartStoppedContainer(c *check.C) { dockerCmd(c, "restart", cleanedContainerID) + // Wait until the container has stopped + err = waitInspect(cleanedContainerID, "{{.State.Running}}", "false", 20*time.Second) + c.Assert(err, checker.IsNil) + out, _ = dockerCmd(c, "logs", cleanedContainerID) c.Assert(out, checker.Equals, "foobar\nfoobar\n") } |
