1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Fix flaky windows TestRestartRunningContainer test

I was seeing this for windowsRS1 testing:
17:20:36 ----------------------------------------------------------------------
17:20:36 FAIL: docker_cli_restart_test.go:31: DockerSuite.TestRestartRunningContainer
17:20:36
17:20:36 docker_cli_restart_test.go:39:
17:20:36     c.Assert(out, checker.Equals, "foobar\n")
17:20:36 ... obtained string = ""
17:20:36 ... expected string = "foobar\n"
17:20:36
17:20:59
17:20:59 ----------------------------------------------------------------------

and I think its because there's a delay between the time the container is
started and the 'echo' is actually run. This gives it up to 10 seconds
to do the 'echo' before giving up.

/cc @jhowardmsft

Signed-off-by: Doug Davis <dug@us.ibm.com>
This commit is contained in:
Doug Davis 2016-12-28 17:54:47 -08:00
parent 9fab262690
commit bae22d167c

View file

@ -35,16 +35,19 @@ func (s *DockerSuite) TestRestartRunningContainer(c *check.C) {
c.Assert(waitRun(cleanedContainerID), checker.IsNil)
out, _ = dockerCmd(c, "logs", cleanedContainerID)
c.Assert(out, checker.Equals, "foobar\n")
getLogs := func(c *check.C) (interface{}, check.CommentInterface) {
out, _ := dockerCmd(c, "logs", cleanedContainerID)
return out, nil
}
// Wait 10 seconds for the 'echo' to appear in the logs
waitAndAssert(c, 10*time.Second, getLogs, checker.Equals, "foobar\n")
dockerCmd(c, "restart", "-t", "1", cleanedContainerID)
out, _ = dockerCmd(c, "logs", cleanedContainerID)
c.Assert(waitRun(cleanedContainerID), checker.IsNil)
c.Assert(out, checker.Equals, "foobar\nfoobar\n")
// Wait 10 seconds for first 'echo' appear (again) in the logs
waitAndAssert(c, 10*time.Second, getLogs, checker.Equals, "foobar\nfoobar\n")
}
// Test that restarting a container with a volume does not create a new volume on restart. Regression test for #819.