Browse code

integration-cli/docker_cli_logs_test.go: Wait()

To avoid a zombie apocalypse, use cmd.Wait() to properly finish
the processes we spawn by Start().

Found while investigating DockerSuite.TestLogsFollowSlowStdoutConsumer
failure on ARM (see
https://github.com/moby/moby/pull/34550#issuecomment-324937936).

[v2: don't expect no error from Wait() when process is killed]

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>

Kir Kolyshkin authored on 2017/08/28 21:22:09
Showing 1 changed files
... ...
@@ -239,6 +239,8 @@ func (s *DockerSuite) TestLogsFollowSlowStdoutConsumer(c *check.C) {
239 239
 	bytes2, err := ConsumeWithSpeed(stdout, 32*1024, 0, nil)
240 240
 	c.Assert(err, checker.IsNil)
241 241
 
242
+	c.Assert(logCmd.Wait(), checker.IsNil)
243
+
242 244
 	actual := bytes1 + bytes2
243 245
 	c.Assert(actual, checker.Equals, expected)
244 246
 }
... ...
@@ -288,6 +290,7 @@ func (s *DockerSuite) TestLogsFollowGoroutinesWithStdout(c *check.C) {
288 288
 	c.Assert(<-chErr, checker.IsNil)
289 289
 	c.Assert(cmd.Process.Kill(), checker.IsNil)
290 290
 	r.Close()
291
+	cmd.Wait()
291 292
 	// NGoroutines is not updated right away, so we need to wait before failing
292 293
 	c.Assert(waitForGoroutines(nroutines), checker.IsNil)
293 294
 }
... ...
@@ -303,6 +306,7 @@ func (s *DockerSuite) TestLogsFollowGoroutinesNoOutput(c *check.C) {
303 303
 	c.Assert(cmd.Start(), checker.IsNil)
304 304
 	time.Sleep(200 * time.Millisecond)
305 305
 	c.Assert(cmd.Process.Kill(), checker.IsNil)
306
+	cmd.Wait()
306 307
 
307 308
 	// NGoroutines is not updated right away, so we need to wait before failing
308 309
 	c.Assert(waitForGoroutines(nroutines), checker.IsNil)