MCPcopy Index your code
hub / github.com/containerd/containerd / TestAppendDistributionLabel

Function TestAppendDistributionLabel

core/remotes/docker/handler_test.go:27–70  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

25)
26
27func TestAppendDistributionLabel(t *testing.T) {
28 for _, tc := range []struct {
29 originLabel string
30 repo string
31 expected string
32 }{
33 {
34 originLabel: "",
35 repo: "",
36 expected: "",
37 },
38 {
39 originLabel: "",
40 repo: "library/busybox",
41 expected: "library/busybox",
42 },
43 {
44 originLabel: "library/busybox",
45 repo: "library/busybox",
46 expected: "library/busybox",
47 },
48 // remove the duplicate one in origin
49 {
50 originLabel: "library/busybox,library/redis,library/busybox",
51 repo: "library/alpine",
52 expected: "library/alpine,library/busybox,library/redis",
53 },
54 // remove the empty repo
55 {
56 originLabel: "library/busybox,library/redis,library/busybox",
57 repo: "",
58 expected: "library/busybox,library/redis",
59 },
60 {
61 originLabel: "library/busybox,library/redis,library/busybox",
62 repo: "library/redis",
63 expected: "library/busybox,library/redis",
64 },
65 } {
66 if got := appendDistributionSourceLabel(tc.originLabel, tc.repo); !reflect.DeepEqual(got, tc.expected) {
67 t.Fatalf("expected %v, but got %v", tc.expected, got)
68 }
69 }
70}
71
72func TestDistributionSourceLabelKey(t *testing.T) {
73 expected := labels.LabelDistributionSource + ".testsource"

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…