Signed-off-by: Brian Goff <cpuguy83@gmail.com>
| ... | ... |
@@ -102,7 +102,7 @@ func (s *DockerSuite) TestStatsAllNewContainersAdded(c *check.C) {
|
| 102 | 102 |
id := make(chan string) |
| 103 | 103 |
addedChan := make(chan struct{})
|
| 104 | 104 |
|
| 105 |
- dockerCmd(c, "run", "-d", "busybox", "top") |
|
| 105 |
+ runSleepingContainer(c, "-d") |
|
| 106 | 106 |
statsCmd := exec.Command(dockerBinary, "stats") |
| 107 | 107 |
stdout, err := statsCmd.StdoutPipe() |
| 108 | 108 |
c.Assert(err, check.IsNil) |
| ... | ... |
@@ -118,16 +118,17 @@ func (s *DockerSuite) TestStatsAllNewContainersAdded(c *check.C) {
|
| 118 | 118 |
switch {
|
| 119 | 119 |
case matchID.MatchString(scanner.Text()): |
| 120 | 120 |
close(addedChan) |
| 121 |
+ return |
|
| 121 | 122 |
} |
| 122 | 123 |
} |
| 123 | 124 |
}() |
| 124 | 125 |
|
| 125 |
- out, _ := dockerCmd(c, "run", "-d", "busybox", "top") |
|
| 126 |
+ out, _ := runSleepingContainer(c, "-d") |
|
| 126 | 127 |
c.Assert(waitRun(strings.TrimSpace(out)), check.IsNil) |
| 127 | 128 |
id <- strings.TrimSpace(out)[:12] |
| 128 | 129 |
|
| 129 | 130 |
select {
|
| 130 |
- case <-time.After(10 * time.Second): |
|
| 131 |
+ case <-time.After(30 * time.Second): |
|
| 131 | 132 |
c.Fatal("failed to observe new container created added to stats")
|
| 132 | 133 |
case <-addedChan: |
| 133 | 134 |
// ignore, done |