Merge pull request #23217 from clnperez/speedup-pushfail-tests

test trusted push: use a nonexistant hostname
This commit is contained in:
Alexander Morozov 2016-06-06 10:12:42 -07:00
commit 4f1c5772a8

View file

@ -321,7 +321,8 @@ func (s *DockerTrustSuite) TestTrustedPushWithFailingServer(c *check.C) {
dockerCmd(c, "tag", "busybox", 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)
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"))
@ -333,7 +334,8 @@ func (s *DockerTrustSuite) TestTrustedPushWithoutServerAndUntrusted(c *check.C)
dockerCmd(c, "tag", "busybox", 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)
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:"))