From 1a9f5f4c69451c580595d67844f41937b3293069 Mon Sep 17 00:00:00 2001 From: Yong Tang Date: Wed, 16 Mar 2016 15:21:29 +0000 Subject: [PATCH] Fix flaky test TestRunAttachFailedNoLeak in #21247. The issue of the flaky test is because when the second container starts, the first container in the detached mode may have only been created and not yet entering the running state. So the port 8000 might be used by the second container first. This fix added a check to make sure the first container is already in running state, before the second container is invoked. This fix fixes #21247. Signed-off-by: Yong Tang --- integration-cli/docker_cli_run_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/integration-cli/docker_cli_run_test.go b/integration-cli/docker_cli_run_test.go index bfed1f775a..0d1dd34f91 100644 --- a/integration-cli/docker_cli_run_test.go +++ b/integration-cli/docker_cli_run_test.go @@ -4226,6 +4226,9 @@ func (s *DockerSuite) TestRunAttachFailedNoLeak(c *check.C) { runSleepingContainer(c, "--name=test", "-p", "8000:8000") + // Wait until container is fully up and running + c.Assert(waitRun("test"), check.IsNil) + out, _, err := dockerCmdWithError("run", "-p", "8000:8000", "busybox", "true") c.Assert(err, checker.NotNil) // check for windows error as well