From efd281d6ebfe4e6a493d00382f3891ee0e90b02e Mon Sep 17 00:00:00 2001 From: Brian Goff Date: Fri, 26 Feb 2016 16:50:50 -0500 Subject: [PATCH] Fix flakey TestStatsAllNewContainersAdded Signed-off-by: Brian Goff --- integration-cli/docker_cli_stats_test.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/integration-cli/docker_cli_stats_test.go b/integration-cli/docker_cli_stats_test.go index 63a2283553..4a3682bb9e 100644 --- a/integration-cli/docker_cli_stats_test.go +++ b/integration-cli/docker_cli_stats_test.go @@ -102,7 +102,7 @@ func (s *DockerSuite) TestStatsAllNewContainersAdded(c *check.C) { id := make(chan string) addedChan := make(chan struct{}) - dockerCmd(c, "run", "-d", "busybox", "top") + runSleepingContainer(c, "-d") statsCmd := exec.Command(dockerBinary, "stats") stdout, err := statsCmd.StdoutPipe() c.Assert(err, check.IsNil) @@ -118,16 +118,17 @@ func (s *DockerSuite) TestStatsAllNewContainersAdded(c *check.C) { switch { case matchID.MatchString(scanner.Text()): close(addedChan) + return } } }() - out, _ := dockerCmd(c, "run", "-d", "busybox", "top") + out, _ := runSleepingContainer(c, "-d") c.Assert(waitRun(strings.TrimSpace(out)), check.IsNil) id <- strings.TrimSpace(out)[:12] select { - case <-time.After(10 * time.Second): + case <-time.After(30 * time.Second): c.Fatal("failed to observe new container created added to stats") case <-addedChan: // ignore, done