summaryrefslogtreecommitdiff
path: root/integration-cli/docker_cli_push_test.go
diff options
context:
space:
mode:
authorAntonio Murdaca <runcom@redhat.com>2016-03-18 18:54:05 +0100
committerAntonio Murdaca <runcom@redhat.com>2016-03-19 12:20:14 +0100
commit264b5b60832bf1f1342618d059c0ece3358de7e1 (patch)
tree08afabef5c675a3987eca3ac4e6a04cbd92dc99b /integration-cli/docker_cli_push_test.go
parentc48439af7f33fccc17013ae7f9e64d4c107502f1 (diff)
downloaddocker-264b5b60832bf1f1342618d059c0ece3358de7e1.tar.gz
distribution: errors: do not retry if no token in response
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
Diffstat (limited to 'integration-cli/docker_cli_push_test.go')
-rw-r--r--integration-cli/docker_cli_push_test.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/integration-cli/docker_cli_push_test.go b/integration-cli/docker_cli_push_test.go
index 0bb4a956f7..f45531206d 100644
--- a/integration-cli/docker_cli_push_test.go
+++ b/integration-cli/docker_cli_push_test.go
@@ -546,6 +546,7 @@ func (s *DockerSuite) TestPushToCentralRegistryUnauthorized(c *check.C) {
dockerCmd(c, "tag", "busybox", repoName)
out, _, err := dockerCmdWithError("push", repoName)
c.Assert(err, check.NotNil, check.Commentf(out))
+ c.Assert(out, check.Not(checker.Contains), "Retrying")
c.Assert(out, checker.Contains, "unauthorized: access to the requested resource is not authorized")
}
@@ -607,3 +608,16 @@ func (s *DockerRegistryAuthTokenSuite) TestPushMisconfiguredTokenServiceResponse
split := strings.Split(out, "\n")
c.Assert(split[len(split)-2], checker.Contains, "error parsing HTTP 403 response body: ")
}
+
+func (s *DockerRegistryAuthTokenSuite) TestPushMisconfiguredTokenServiceResponseNoToken(c *check.C) {
+ ts := getTestTokenService(http.StatusOK, `{"something": "wrong"}`)
+ defer ts.Close()
+ s.setupRegistryWithTokenService(c, ts.URL)
+ repoName := fmt.Sprintf("%s/busybox", privateRegistryURL)
+ dockerCmd(c, "tag", "busybox", repoName)
+ out, _, err := dockerCmdWithError("push", repoName)
+ c.Assert(err, check.NotNil, check.Commentf(out))
+ c.Assert(out, checker.Not(checker.Contains), "Retrying")
+ split := strings.Split(out, "\n")
+ c.Assert(split[len(split)-2], check.Equals, "authorization server did not include a token in the response")
+}