MCPcopy Create free account
hub / github.com/conforma/cli / TestTrack

Function TestTrack

internal/tracker/tracker_test.go:89–437  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

87)
88
89func TestTrack(t *testing.T) {
90 tests := []struct {
91 name string
92 urls []string
93 prune bool
94 output string
95 input []byte
96 freshen bool
97 }{
98 {
99 name: "always insert at the front",
100 urls: []string{
101 "registry.com/repo:two@" + sampleHashTwo.String(),
102 "registry.com/repo:one@" + sampleHashOne.String(),
103 },
104 output: hd.Doc(`
105 ---
106 trusted_tasks:
107 oci://registry.com/repo:one:
108 - ref: ` + sampleHashOne.String() + `
109 oci://registry.com/repo:two:
110 - ref: ` + sampleHashTwo.String() + `
111 `),
112 },
113 {
114 name: "multiple repos",
115 urls: []string{
116 "registry.com/one:1.0@" + sampleHashOne.String(),
117 "registry.com/two:2.0@" + sampleHashTwo.String(),
118 },
119 output: hd.Doc(`
120 ---
121 trusted_tasks:
122 oci://registry.com/one:1.0:
123 - ref: ` + sampleHashOne.String() + `
124 oci://registry.com/two:2.0:
125 - ref: ` + sampleHashTwo.String() + `
126 `),
127 },
128 {
129 name: "update existing repo",
130 urls: []string{
131 "registry.com/repo:two@" + sampleHashTwo.String(),
132 },
133 input: []byte(hd.Doc(
134 `---
135 trusted_tasks:
136 oci://registry.com/repo:one:
137 - ref: ` + sampleHashOne.String() + `
138 `)),
139 output: hd.Doc(
140 `---
141 trusted_tasks:
142 oci://registry.com/repo:one:
143 - ref: ` + sampleHashOne.String() + `
144 oci://registry.com/repo:two:
145 - ref: ` + sampleHashTwo.String() + `
146 `),

Callers

nothing calls this directly

Calls 4

TrackFunction · 0.85
WithClientFunction · 0.70
RunMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected