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

Function TestParseReferenceWithTagAndDigest

docker/reference/normalize_test.go:265–284  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

263}
264
265func TestParseReferenceWithTagAndDigest(t *testing.T) {
266 shortRef := "busybox:latest@sha256:86e0e091d0da6bde2456dbb48306f3956bbeb2eae1b5b9a43045843f69fe4aaa"
267 ref, err := ParseNormalizedNamed(shortRef)
268 if err != nil {
269 t.Fatal(err)
270 }
271 if expected, actual := "docker.io/library/"+shortRef, ref.String(); actual != expected {
272 t.Fatalf("Invalid parsed reference for %q: expected %q, got %q", ref, expected, actual)
273 }
274
275 if _, isTagged := ref.(NamedTagged); !isTagged {
276 t.Fatalf("Reference from %q should support tag", ref)
277 }
278 if _, isCanonical := ref.(Canonical); !isCanonical {
279 t.Fatalf("Reference from %q should support digest", ref)
280 }
281 if expected, actual := shortRef, FamiliarString(ref); actual != expected {
282 t.Fatalf("Invalid parsed reference for %q: expected %q, got %q", ref, expected, actual)
283 }
284}
285
286func TestInvalidReferenceComponents(t *testing.T) {
287 if _, err := ParseNormalizedNamed("-foo"); err == nil {

Callers

nothing calls this directly

Calls 3

ParseNormalizedNamedFunction · 0.85
FamiliarStringFunction · 0.85
StringMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…