MCPcopy
hub / github.com/containerd/containerd / TestImageIsUnpacked

Function TestImageIsUnpacked

integration/client/image_test.go:36–81  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

34)
35
36func TestImageIsUnpacked(t *testing.T) {
37 imageName := imagelist.Get(imagelist.Pause)
38 ctx, cancel := testContext(t)
39 defer cancel()
40
41 client, err := newClient(t, address)
42 if err != nil {
43 t.Fatal(err)
44 }
45 defer client.Close()
46
47 // Cleanup
48 opts := []images.DeleteOpt{images.SynchronousDelete()}
49 err = client.ImageService().Delete(ctx, imageName, opts...)
50 if err != nil && !errdefs.IsNotFound(err) {
51 t.Fatal(err)
52 }
53
54 // By default pull does not unpack an image
55 image, err := client.Pull(ctx, imageName, WithPlatformMatcher(platforms.Default()))
56 if err != nil {
57 t.Fatal(err)
58 }
59
60 // Check that image is not unpacked
61 unpacked, err := image.IsUnpacked(ctx, defaults.DefaultSnapshotter)
62 if err != nil {
63 t.Fatal(err)
64 }
65 if unpacked {
66 t.Fatalf("image should not be unpacked")
67 }
68
69 // Check that image is unpacked
70 err = image.Unpack(ctx, defaults.DefaultSnapshotter)
71 if err != nil {
72 t.Fatal(err)
73 }
74 unpacked, err = image.IsUnpacked(ctx, defaults.DefaultSnapshotter)
75 if err != nil {
76 t.Fatal(err)
77 }
78 if !unpacked {
79 t.Fatalf("image should be unpacked")
80 }
81}
82
83func TestImagePullWithDistSourceLabel(t *testing.T) {
84 var (

Callers

nothing calls this directly

Calls 11

testContextFunction · 0.85
newClientFunction · 0.85
WithPlatformMatcherFunction · 0.85
FatalMethod · 0.80
GetMethod · 0.65
CloseMethod · 0.65
DeleteMethod · 0.65
ImageServiceMethod · 0.65
PullMethod · 0.65
IsUnpackedMethod · 0.65
UnpackMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…