mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Fix flakey TestStatsAllNewContainersAdded
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
This commit is contained in:
parent
2f797bb1d9
commit
efd281d6eb
1 changed files with 4 additions and 3 deletions
|
@ -102,7 +102,7 @@ func (s *DockerSuite) TestStatsAllNewContainersAdded(c *check.C) {
|
||||||
id := make(chan string)
|
id := make(chan string)
|
||||||
addedChan := make(chan struct{})
|
addedChan := make(chan struct{})
|
||||||
|
|
||||||
dockerCmd(c, "run", "-d", "busybox", "top")
|
runSleepingContainer(c, "-d")
|
||||||
statsCmd := exec.Command(dockerBinary, "stats")
|
statsCmd := exec.Command(dockerBinary, "stats")
|
||||||
stdout, err := statsCmd.StdoutPipe()
|
stdout, err := statsCmd.StdoutPipe()
|
||||||
c.Assert(err, check.IsNil)
|
c.Assert(err, check.IsNil)
|
||||||
|
@ -118,16 +118,17 @@ func (s *DockerSuite) TestStatsAllNewContainersAdded(c *check.C) {
|
||||||
switch {
|
switch {
|
||||||
case matchID.MatchString(scanner.Text()):
|
case matchID.MatchString(scanner.Text()):
|
||||||
close(addedChan)
|
close(addedChan)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
|
out, _ := runSleepingContainer(c, "-d")
|
||||||
c.Assert(waitRun(strings.TrimSpace(out)), check.IsNil)
|
c.Assert(waitRun(strings.TrimSpace(out)), check.IsNil)
|
||||||
id <- strings.TrimSpace(out)[:12]
|
id <- strings.TrimSpace(out)[:12]
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case <-time.After(10 * time.Second):
|
case <-time.After(30 * time.Second):
|
||||||
c.Fatal("failed to observe new container created added to stats")
|
c.Fatal("failed to observe new container created added to stats")
|
||||||
case <-addedChan:
|
case <-addedChan:
|
||||||
// ignore, done
|
// ignore, done
|
||||||
|
|
Loading…
Reference in a new issue