(t *testing.T)
| 25 | ) |
| 26 | |
| 27 | func 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 | |
| 72 | func TestDistributionSourceLabelKey(t *testing.T) { |
| 73 | expected := labels.LabelDistributionSource + ".testsource" |
nothing calls this directly
no test coverage detected
searching dependent graphs…