MCPcopy
hub / github.com/containerd/containerd / TestImagesCreateUpdateDelete

Function TestImagesCreateUpdateDelete

core/metadata/images_test.go:148–608  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

146 }
147}
148func TestImagesCreateUpdateDelete(t *testing.T) {
149 ctx, db := testEnv(t)
150 store := NewImageStore(NewDB(db, nil, nil))
151
152 for _, testcase := range []struct {
153 name string
154 original images.Image
155 createerr error
156 input images.Image // Input target size determines target digest, base image uses 10
157 fieldpaths []string
158 expected images.Image
159 cause error
160 deleteerr error
161 }{
162 {
163 name: "Touch",
164 original: imageBase(),
165 input: images.Image{
166 Labels: map[string]string{
167 "foo": "bar",
168 "baz": "boo",
169 },
170 Target: ocispec.Descriptor{
171 Size: 10,
172 MediaType: "application/vnd.oci.blab",
173 Annotations: map[string]string{
174 "foo": "bar",
175 },
176 },
177 },
178 expected: images.Image{
179 Labels: map[string]string{
180 "foo": "bar",
181 "baz": "boo",
182 },
183 Target: ocispec.Descriptor{
184 Size: 10,
185 MediaType: "application/vnd.oci.blab",
186 Annotations: map[string]string{
187 "foo": "bar",
188 },
189 },
190 },
191 },
192 {
193 name: "NoTarget",
194 original: images.Image{
195 Labels: map[string]string{
196 "foo": "bar",
197 "baz": "boo",
198 },
199 Target: ocispec.Descriptor{},
200 },
201 createerr: errdefs.ErrInvalidArgument,
202 },
203 {
204 name: "ReplaceLabels",
205 original: imageBase(),

Callers

nothing calls this directly

Calls 15

DeleteTargetFunction · 0.92
NewImageStoreFunction · 0.85
NewDBFunction · 0.85
imageBaseFunction · 0.85
checkImageTimestampsFunction · 0.85
checkImagesEqualFunction · 0.85
UnwrapMethod · 0.80
FatalMethod · 0.80
LogMethod · 0.80
testEnvFunction · 0.70
RunMethod · 0.65
CreateMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…