From dd976e61706fcd30ccccbed45338268e86d428cc Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Mon, 28 Aug 2017 15:22:09 +0300 Subject: [PATCH] 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 Upstream-commit: 14f0a1888f92667f82bea548bfa2fe4a890a75e8 Component: engine --- components/engine/integration-cli/docker_cli_logs_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/components/engine/integration-cli/docker_cli_logs_test.go b/components/engine/integration-cli/docker_cli_logs_test.go index 0209f456dd..d9523bffcc 100644 --- a/components/engine/integration-cli/docker_cli_logs_test.go +++ b/components/engine/integration-cli/docker_cli_logs_test.go @@ -239,6 +239,8 @@ func (s *DockerSuite) TestLogsFollowSlowStdoutConsumer(c *check.C) { bytes2, err := ConsumeWithSpeed(stdout, 32*1024, 0, nil) c.Assert(err, checker.IsNil) + c.Assert(logCmd.Wait(), checker.IsNil) + actual := bytes1 + bytes2 c.Assert(actual, checker.Equals, expected) } @@ -288,6 +290,7 @@ func (s *DockerSuite) TestLogsFollowGoroutinesWithStdout(c *check.C) { c.Assert(<-chErr, checker.IsNil) c.Assert(cmd.Process.Kill(), checker.IsNil) r.Close() + cmd.Wait() // NGoroutines is not updated right away, so we need to wait before failing c.Assert(waitForGoroutines(nroutines), checker.IsNil) } @@ -303,6 +306,7 @@ func (s *DockerSuite) TestLogsFollowGoroutinesNoOutput(c *check.C) { c.Assert(cmd.Start(), checker.IsNil) time.Sleep(200 * time.Millisecond) c.Assert(cmd.Process.Kill(), checker.IsNil) + cmd.Wait() // NGoroutines is not updated right away, so we need to wait before failing c.Assert(waitForGoroutines(nroutines), checker.IsNil)