MCPcopy Create free account
hub / github.com/containers/image / TestNeedsRetryOnInsuficientScope

Function TestNeedsRetryOnInsuficientScope

docker/docker_client_test.go:203–223  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

201}
202
203func TestNeedsRetryOnInsuficientScope(t *testing.T) {
204 resp := registrySuseComResp
205 resp.Header["Www-Authenticate"] = []string{
206 `Bearer realm="https://registry.suse.com/auth",service="SUSE Linux Docker Registry",scope="registry:catalog:*",error="insufficient_scope"`,
207 }
208 expectedScope := authScope{
209 resourceType: "registry",
210 remoteName: "catalog",
211 actions: "*",
212 }
213
214 needsRetry, scope := needsRetryWithUpdatedScope(&resp)
215
216 if !needsRetry {
217 t.Fatal("Expected needing to retry")
218 }
219
220 if expectedScope != *scope {
221 t.Fatalf("Got an invalid scope, expected '%q' but got '%q'", expectedScope, *scope)
222 }
223}
224
225func TestNeedsRetryNoRetryWhenNoAuthHeader(t *testing.T) {
226 resp := registrySuseComResp

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…