MCPcopy Create free account
hub / github.com/containers/image / createUncommittedImageDest

Function createUncommittedImageDest

storage/storage_test.go:350–379  ·  view source on GitHub ↗
(t *testing.T, ref types.ImageReference, cache types.BlobInfoCache,
	layers []testBlob, config *testBlob)

Source from the content-addressed store, hash-verified

348}
349
350func createUncommittedImageDest(t *testing.T, ref types.ImageReference, cache types.BlobInfoCache,
351 layers []testBlob, config *testBlob) (types.ImageDestination, types.UnparsedImage) {
352 dest, err := ref.NewImageDestination(context.Background(), nil)
353 require.NoError(t, err)
354
355 layerDescriptors := []manifest.Schema2Descriptor{}
356 for _, layer := range layers {
357 desc := layer.storeBlob(t, dest, cache, manifest.DockerV2Schema2LayerMediaType, false)
358 layerDescriptors = append(layerDescriptors, desc)
359 }
360
361 if config == nil {
362 cd := configForLayers(t, layers)
363 config = &cd
364 }
365 configDescriptor := config.storeBlob(t, dest, cache, manifest.DockerV2Schema2ConfigMediaType, true)
366
367 manifest := manifest.Schema2FromComponents(configDescriptor, layerDescriptors)
368 manifestBytes, err := manifest.Serialize()
369 require.NoError(t, err)
370 err = dest.PutManifest(context.Background(), manifestBytes, nil)
371 require.NoError(t, err)
372 unparsedToplevel := unparsedImage{
373 imageReference: nil,
374 manifestBytes: manifestBytes,
375 manifestType: manifest.MediaType,
376 signatures: nil,
377 }
378 return dest, &unparsedToplevel
379}
380
381func createImage(t *testing.T, ref types.ImageReference, cache types.BlobInfoCache,
382 layers []testBlob, config *testBlob) {

Callers 3

createImageFunction · 0.85
TestDuplicateIDFunction · 0.85
TestDuplicateNameIDFunction · 0.85

Calls 6

PutManifestMethod · 0.95
Schema2FromComponentsFunction · 0.92
configForLayersFunction · 0.85
storeBlobMethod · 0.80
NewImageDestinationMethod · 0.65
SerializeMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…