Fix flakyness in TestDockerNetworkInternalMode

Instead of waiting for the DNS to fail, try to access
a specific external IP and verify that 100% of the pakcets
are being lost.

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
This commit is contained in:
Flavio Crisciani 2018-07-13 11:21:44 -07:00
parent 23f4a3d509
commit a2bb2144b3
No known key found for this signature in database
GPG Key ID: 28CAFCE754CF3A48
1 changed files with 2 additions and 2 deletions

View File

@ -1644,9 +1644,9 @@ func (s *DockerSuite) TestDockerNetworkInternalMode(c *check.C) {
c.Assert(waitRun("first"), check.IsNil)
dockerCmd(c, "run", "-d", "--net=internal", "--name=second", "busybox:glibc", "top")
c.Assert(waitRun("second"), check.IsNil)
out, _, err := dockerCmdWithError("exec", "first", "ping", "-W", "4", "-c", "1", "www.google.com")
out, _, err := dockerCmdWithError("exec", "first", "ping", "-W", "4", "-c", "1", "8.8.8.8")
c.Assert(err, check.NotNil)
c.Assert(out, checker.Contains, "ping: bad address")
c.Assert(out, checker.Contains, "100% packet loss")
_, _, err = dockerCmdWithError("exec", "second", "ping", "-c", "1", "first")
c.Assert(err, check.IsNil)
}