(t *testing.T)
| 34 | ) |
| 35 | |
| 36 | func 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 | |
| 83 | func TestImagePullWithDistSourceLabel(t *testing.T) { |
| 84 | var ( |
nothing calls this directly
no test coverage detected
searching dependent graphs…