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

Function TestImageReferenceString

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

Source from the content-addressed store, hash-verified

126}
127
128func TestImageReferenceString(t *testing.T) {
129 cases := []struct {
130 name string
131 ref ImageReference
132 expected string
133 }{
134 {
135 name: "repository only",
136 ref: ImageReference{
137 Repository: "repository.com/repo",
138 },
139 expected: "repository.com/repo",
140 },
141 {
142 name: "digest only",
143 ref: ImageReference{
144 Repository: "repository.com/repo",
145 Digest: testHash.String(),
146 },
147 expected: "repository.com/repo@" + testHash.String(),
148 },
149 {
150 name: "tag only",
151 ref: ImageReference{
152 Repository: "repository.com/repo",
153 Tag: "1.0",
154 },
155 expected: "repository.com/repo:1.0",
156 },
157 {
158 name: "both digest and tag",
159 ref: ImageReference{
160 Repository: "repository.com/repo",
161 Digest: testHash.String(),
162 Tag: "1.0",
163 },
164 expected: "repository.com/repo:1.0@" + testHash.String(),
165 },
166 }
167
168 for _, c := range cases {
169 t.Run("", func(t *testing.T) {
170 assert.Equal(t, c.expected, c.ref.String())
171 })
172 }
173}
174
175func TestImageReferenceRef(t *testing.T) {
176 tests := []struct {

Callers

nothing calls this directly

Calls 2

RunMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected