浏览代码

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 9 年之前
父节点
当前提交
431e7b6573
共有 1 个文件被更改,包括 4 次插入2 次删除
  1. 4 2
      integration-cli/docker_cli_push_test.go

+ 4 - 2
integration-cli/docker_cli_push_test.go

@@ -321,7 +321,8 @@ func (s *DockerTrustSuite) TestTrustedPushWithFailingServer(c *check.C) {
 	dockerCmd(c, "tag", "busybox", repoName)
 	dockerCmd(c, "tag", "busybox", repoName)
 
 
 	pushCmd := exec.Command(dockerBinary, "push", repoName)
 	pushCmd := exec.Command(dockerBinary, "push", repoName)
-	s.trustedCmdWithServer(pushCmd, "https://example.com:81/")
+	// Using a name that doesn't resolve to an address makes this test faster
+	s.trustedCmdWithServer(pushCmd, "https://server.invalid:81/")
 	out, _, err := runCommandWithOutput(pushCmd)
 	out, _, err := runCommandWithOutput(pushCmd)
 	c.Assert(err, check.NotNil, check.Commentf("Missing error while running trusted push w/ no server"))
 	c.Assert(err, check.NotNil, check.Commentf("Missing error while running trusted push w/ no server"))
 	c.Assert(out, checker.Contains, "error contacting notary server", check.Commentf("Missing expected output on trusted push"))
 	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)
 	dockerCmd(c, "tag", "busybox", repoName)
 	dockerCmd(c, "tag", "busybox", repoName)
 
 
 	pushCmd := exec.Command(dockerBinary, "push", "--disable-content-trust", repoName)
 	pushCmd := exec.Command(dockerBinary, "push", "--disable-content-trust", repoName)
-	s.trustedCmdWithServer(pushCmd, "https://example.com/")
+	// Using a name that doesn't resolve to an address makes this test faster
+	s.trustedCmdWithServer(pushCmd, "https://server.invalid")
 	out, _, err := runCommandWithOutput(pushCmd)
 	out, _, err := runCommandWithOutput(pushCmd)
 	c.Assert(err, check.IsNil, check.Commentf("trusted push with no server and --disable-content-trust failed: %s\n%s", err, out))
 	c.Assert(err, check.IsNil, check.Commentf("trusted push with no server and --disable-content-trust failed: %s\n%s", err, out))
 	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:"))
 	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:"))