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>
This commit is contained in:
Yong Tang 2016-03-16 15:21:29 +00:00
Родитель b1e9a5eaf1
Коммит 1a9f5f4c69
1 изменённых файлов: 3 добавлений и 0 удалений

Просмотреть файл

@ -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