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

Function TestImageReferenceRef

internal/image/process_test.go:175–281  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

173}
174
175func TestImageReferenceRef(t *testing.T) {
176 tests := []struct {
177 name string
178 url string
179 opts []name.Option
180 expectError bool
181 errorMsg string
182 }{
183 {
184 name: "repository with tag",
185 url: "registry.com/repo:v1.0.0",
186 },
187 {
188 name: "repository with digest",
189 url: "registry.com/repo@sha256:01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b",
190 },
191 {
192 name: "repository with tag and digest",
193 url: "registry.com/repo:v1.0.0@sha256:01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b",
194 },
195 {
196 name: "repository only (defaults to latest)",
197 url: "registry.com/repo",
198 },
199 {
200 name: "docker.io registry",
201 url: "docker.io/library/ubuntu:20.04",
202 },
203 {
204 name: "localhost registry",
205 url: "localhost:5000/test/image:latest",
206 },
207 {
208 name: "gcr.io registry",
209 url: "gcr.io/project/image:tag",
210 },
211 {
212 name: "invalid URL - empty string",
213 url: "",
214 expectError: true,
215 errorMsg: "could not parse reference",
216 },
217 {
218 name: "invalid URL - malformed",
219 url: "invalid::reference",
220 expectError: true,
221 errorMsg: "could not parse reference",
222 },
223 {
224 name: "invalid URL - invalid digest",
225 url: "registry.com/repo@sha256:invalid",
226 opts: []name.Option{name.StrictValidation},
227 expectError: true,
228 errorMsg: "could not parse reference",
229 },
230 }
231
232 for _, tt := range tests {

Callers

nothing calls this directly

Calls 6

RefMethod · 0.95
NewImageReferenceFunction · 0.85
RunMethod · 0.65
ErrorMethod · 0.65
NameMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected