MCPcopy Create free account
hub / github.com/containerd/nerdctl / TestReferenceUtil

Function TestReferenceUtil

pkg/referenceutil/referenceutil_test.go:26–303  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

24)
25
26func TestReferenceUtil(t *testing.T) {
27 needles := map[string]struct {
28 Error string
29 String string
30 Suggested string
31 FamiliarName string
32 FamiliarMatch map[string]bool
33 Protocol Protocol
34 Digest digest.Digest
35 Path string
36 Domain string
37 Tag string
38 ExplicitTag string
39 }{
40 "": {
41 Error: "invalid reference format",
42 },
43 "∞": {
44 Error: "invalid reference format",
45 },
46 "abcd:∞": {
47 Error: "invalid reference format",
48 },
49 "abcd@sha256:∞": {
50 Error: "invalid reference format",
51 },
52 "abcd@∞": {
53 Error: "invalid reference format",
54 },
55 "abcd:foo@sha256:∞": {
56 Error: "invalid reference format",
57 },
58 "abcd:foo@∞": {
59 Error: "invalid reference format",
60 },
61 "sha256:whatever": {
62 Error: "",
63 String: "docker.io/library/sha256:whatever",
64 Suggested: "sha256-abcde",
65 FamiliarName: "sha256",
66 FamiliarMatch: map[string]bool{
67 "*a*": true,
68 "?ha25?": true,
69 "[s-z]ha25[0-9]": true,
70 "[^a]ha25[^a-z]": true,
71 "*6:whatever": true,
72 "docker.io/library/sha256": false,
73 },
74 Protocol: "",
75 Digest: "",
76 Path: "library/sha256",
77 Domain: "docker.io",
78 Tag: "whatever",
79 ExplicitTag: "whatever",
80 },
81 "sha256:4b826db5f1f14d1db0b560304f189d4b17798ddce2278b7822c9d32313fe3f50": {
82 Error: "",
83 String: "sha256:4b826db5f1f14d1db0b560304f189d4b17798ddce2278b7822c9d32313fe3f50",

Callers

nothing calls this directly

Calls 6

SuggestContainerNameMethod · 0.80
FamiliarNameMethod · 0.80
FamiliarMatchMethod · 0.80
ParseFunction · 0.70
ErrorMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…