From 42dc03897a64ee3333614c0e78660d8290ddb311 Mon Sep 17 00:00:00 2001 From: Dennis Chen Date: Wed, 16 May 2018 09:21:55 +0800 Subject: [PATCH] Fix flaky test case of `TestExecInteractiveStdinClose` This issue has been reported by issue #36877. The purpose of this test case is for the regression test of #12546, so we only need to make sure the essential of the testing is still in the way to check that while not disturbed by some testing noises, which is exactly what this PR want to do. Signed-off-by: Dennis Chen Upstream-commit: 96abf9f59ebd350cc9a70034b4d30279e6ae04e4 Component: engine --- .../engine/integration-cli/docker_cli_exec_unix_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/engine/integration-cli/docker_cli_exec_unix_test.go b/components/engine/integration-cli/docker_cli_exec_unix_test.go index 5d8efc70d0..6608a7b704 100644 --- a/components/engine/integration-cli/docker_cli_exec_unix_test.go +++ b/components/engine/integration-cli/docker_cli_exec_unix_test.go @@ -33,7 +33,9 @@ func (s *DockerSuite) TestExecInteractiveStdinClose(c *check.C) { select { case err := <-ch: c.Assert(err, checker.IsNil) - output := b.String() + bs := b.Bytes() + bs = bytes.Trim(bs, "\x00") + output := string(bs[:]) c.Assert(strings.TrimSpace(output), checker.Equals, "hello") case <-time.After(5 * time.Second): c.Fatal("timed out running docker exec")