瀏覽代碼

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 <dennis.chen@arm.com>
Dennis Chen 7 年之前
父節點
當前提交
96abf9f59e
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      integration-cli/docker_cli_exec_unix_test.go

+ 3 - 1
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")