MCPcopy
hub / github.com/containerd/containerd / EnsureImageExists

Function EnsureImageExists

integration/main_test.go:863–876  ·  view source on GitHub ↗

EnsureImageExists pulls the given image, ensures that no error was encountered while pulling it.

(t *testing.T, imageName string)

Source from the content-addressed store, hash-verified

861// EnsureImageExists pulls the given image, ensures that no error was encountered
862// while pulling it.
863func EnsureImageExists(t *testing.T, imageName string) string {
864 img, err := imageService.ImageStatus(&runtime.ImageSpec{Image: imageName})
865 require.NoError(t, err)
866 if img != nil {
867 t.Logf("Image %q already exists, not pulling.", imageName)
868 return img.Id
869 }
870
871 t.Logf("Pull test image %q", imageName)
872 imgID, err := imageService.PullImage(&runtime.ImageSpec{Image: imageName}, nil, nil, "")
873 require.NoError(t, err)
874
875 return imgID
876}
877
878func GetContainer(id string) (containers.Container, error) {
879 return containerdClient.ContainerService().Get(context.Background(), id)

Callers 15

TestPodUserNSFunction · 0.85
TestIssue10598Function · 0.85
TestUsernsVolumeCopyUpFunction · 0.85
TestContainerRestartFunction · 0.85
TestLongContainerLogFunction · 0.85
TestAdditionalGidsFunction · 0.85
TestWindowsRootfsSizeFunction · 0.85

Calls 2

PullImageMethod · 0.65
ImageStatusMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…