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

Function TestParseAndResolveAll

internal/image/process_test.go:37–126  ·  view source on GitHub ↗

func ParseAndResolveAll(urls []string) ([]ImageReference, error) {

(t *testing.T)

Source from the content-addressed store, hash-verified

35
36// func ParseAndResolveAll(urls []string) ([]ImageReference, error) {
37func TestParseAndResolveAll(t *testing.T) {
38 tests := []struct {
39 name string
40 urls []string
41 refs []ImageReference
42 err string
43 headDigest v1.Hash
44 opts []name.Option
45 }{
46 {
47 name: "url contains tag and digest",
48 urls: []string{
49 "registry.com/repo:one@" + testHash.String(),
50 },
51 refs: []ImageReference{
52 {
53 Repository: "registry.com/repo",
54 Digest: testHash.String(),
55 Tag: "one",
56 },
57 },
58 },
59 {
60 name: "url contains only tag",
61 urls: []string{
62 "registry.com/repo:one",
63 },
64 refs: []ImageReference{
65 {
66 Repository: "registry.com/repo",
67 Digest: testHash.String(),
68 Tag: "one",
69 },
70 },
71 headDigest: testHash,
72 },
73 {
74 name: "url contains only digest",
75 urls: []string{
76 "registry.com/repo@" + testHash.String(),
77 },
78 refs: []ImageReference{
79 {
80 Repository: "registry.com/repo",
81 Digest: testHash.String(),
82 Tag: "latest",
83 },
84 },
85 },
86 {
87 name: "errors are collected for each url",
88 urls: []string{
89 // Incomplete digest
90 "registry.com/one@sha256:123",
91 // Bad registry host
92 "registry/two@" + testHash.String(),
93 // Missing repo
94 "three.com@" + testHash.String(),

Callers

nothing calls this directly

Calls 3

ParseAndResolveAllFunction · 0.85
RunMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected