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 <yong.tang.github@outlook.com> Upstream-commit: 1a9f5f4c69451c580595d67844f41937b3293069 Component: engine
This commit is contained in:
@ -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
|
||||
|
||||
Reference in New Issue
Block a user