(t *testing.T)
| 146 | } |
| 147 | } |
| 148 | func 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(), |
nothing calls this directly
no test coverage detected
searching dependent graphs…