Browse code

trusted push test: Use a nonexistant hostname

Before, the TCP handshake had to time out (approx 30s) before
this test completed. If you use a hostname that doesn't resolve,
then it fails faster.

Signed-off-by: Christy Perez <christy@linux.vnet.ibm.com>

Christy Perez authored on 2016/06/03 06:58:53
Showing 1 changed files
... ...
@@ -321,7 +321,8 @@ func (s *DockerTrustSuite) TestTrustedPushWithFailingServer(c *check.C) {
321 321
 	dockerCmd(c, "tag", "busybox", repoName)
322 322
 
323 323
 	pushCmd := exec.Command(dockerBinary, "push", repoName)
324
-	s.trustedCmdWithServer(pushCmd, "https://example.com:81/")
324
+	// Using a name that doesn't resolve to an address makes this test faster
325
+	s.trustedCmdWithServer(pushCmd, "https://server.invalid:81/")
325 326
 	out, _, err := runCommandWithOutput(pushCmd)
326 327
 	c.Assert(err, check.NotNil, check.Commentf("Missing error while running trusted push w/ no server"))
327 328
 	c.Assert(out, checker.Contains, "error contacting notary server", check.Commentf("Missing expected output on trusted push"))
... ...
@@ -333,7 +334,8 @@ func (s *DockerTrustSuite) TestTrustedPushWithoutServerAndUntrusted(c *check.C)
333 333
 	dockerCmd(c, "tag", "busybox", repoName)
334 334
 
335 335
 	pushCmd := exec.Command(dockerBinary, "push", "--disable-content-trust", repoName)
336
-	s.trustedCmdWithServer(pushCmd, "https://example.com/")
336
+	// Using a name that doesn't resolve to an address makes this test faster
337
+	s.trustedCmdWithServer(pushCmd, "https://server.invalid")
337 338
 	out, _, err := runCommandWithOutput(pushCmd)
338 339
 	c.Assert(err, check.IsNil, check.Commentf("trusted push with no server and --disable-content-trust failed: %s\n%s", err, out))
339 340
 	c.Assert(out, check.Not(checker.Contains), "Error establishing connection to notary repository", check.Commentf("Missing expected output on trusted push with --disable-content-trust:"))