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>
| ... | ... |
@@ -35,16 +35,19 @@ func (s *DockerSuite) TestRestartRunningContainer(c *check.C) {
|
| 35 | 35 |
|
| 36 | 36 |
c.Assert(waitRun(cleanedContainerID), checker.IsNil) |
| 37 | 37 |
|
| 38 |
- out, _ = dockerCmd(c, "logs", cleanedContainerID) |
|
| 39 |
- c.Assert(out, checker.Equals, "foobar\n") |
|
| 40 |
- |
|
| 41 |
- dockerCmd(c, "restart", "-t", "1", cleanedContainerID) |
|
| 38 |
+ getLogs := func(c *check.C) (interface{}, check.CommentInterface) {
|
|
| 39 |
+ out, _ := dockerCmd(c, "logs", cleanedContainerID) |
|
| 40 |
+ return out, nil |
|
| 41 |
+ } |
|
| 42 | 42 |
|
| 43 |
- out, _ = dockerCmd(c, "logs", cleanedContainerID) |
|
| 43 |
+ // Wait 10 seconds for the 'echo' to appear in the logs |
|
| 44 |
+ waitAndAssert(c, 10*time.Second, getLogs, checker.Equals, "foobar\n") |
|
| 44 | 45 |
|
| 46 |
+ dockerCmd(c, "restart", "-t", "1", cleanedContainerID) |
|
| 45 | 47 |
c.Assert(waitRun(cleanedContainerID), checker.IsNil) |
| 46 | 48 |
|
| 47 |
- c.Assert(out, checker.Equals, "foobar\nfoobar\n") |
|
| 49 |
+ // Wait 10 seconds for first 'echo' appear (again) in the logs |
|
| 50 |
+ waitAndAssert(c, 10*time.Second, getLogs, checker.Equals, "foobar\nfoobar\n") |
|
| 48 | 51 |
} |
| 49 | 52 |
|
| 50 | 53 |
// Test that restarting a container with a volume does not create a new volume on restart. Regression test for #819. |