mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
api/types/image: move image option types to client
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
This commit is contained in:
@@ -11,7 +11,7 @@ import (
|
||||
|
||||
cerrdefs "github.com/containerd/errdefs"
|
||||
"github.com/containerd/platforms"
|
||||
imagetypes "github.com/moby/moby/api/types/image"
|
||||
"github.com/moby/moby/client"
|
||||
"github.com/moby/moby/v2/testutil"
|
||||
"github.com/moby/moby/v2/testutil/daemon"
|
||||
"gotest.tools/v3/assert"
|
||||
@@ -33,7 +33,7 @@ func TestImportExtremelyLargeImageWorks(t *testing.T) {
|
||||
d.Start(t, "--iptables=false", "--ip6tables=false")
|
||||
defer d.Stop(t)
|
||||
|
||||
client := d.NewClientT(t)
|
||||
apiClient := d.NewClientT(t)
|
||||
|
||||
// Construct an empty tar archive with about 8GB of junk padding at the
|
||||
// end. This should not cause any crashes (the padding should be mostly
|
||||
@@ -46,10 +46,10 @@ func TestImportExtremelyLargeImageWorks(t *testing.T) {
|
||||
imageRdr := io.MultiReader(&tarBuffer, io.LimitReader(testutil.DevZero, 8*1024*1024*1024))
|
||||
reference := strings.ToLower(t.Name()) + ":v42"
|
||||
|
||||
_, err = client.ImageImport(ctx,
|
||||
imagetypes.ImportSource{Source: imageRdr, SourceName: "-"},
|
||||
_, err = apiClient.ImageImport(ctx,
|
||||
client.ImageImportSource{Source: imageRdr, SourceName: "-"},
|
||||
reference,
|
||||
imagetypes.ImportOptions{})
|
||||
client.ImageImportOptions{})
|
||||
assert.NilError(t, err)
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ func TestImportWithCustomPlatform(t *testing.T) {
|
||||
|
||||
ctx := setupTest(t)
|
||||
|
||||
client := testEnv.APIClient()
|
||||
apiClient := testEnv.APIClient()
|
||||
|
||||
// Construct an empty tar archive.
|
||||
var tarBuffer bytes.Buffer
|
||||
@@ -108,13 +108,13 @@ func TestImportWithCustomPlatform(t *testing.T) {
|
||||
ctx := testutil.StartSpan(ctx, t)
|
||||
reference := "import-with-platform:tc-" + strconv.Itoa(i)
|
||||
|
||||
_, err = client.ImageImport(ctx,
|
||||
imagetypes.ImportSource{Source: imageRdr, SourceName: "-"},
|
||||
_, err = apiClient.ImageImport(ctx,
|
||||
client.ImageImportSource{Source: imageRdr, SourceName: "-"},
|
||||
reference,
|
||||
imagetypes.ImportOptions{Platform: tc.platform})
|
||||
client.ImageImportOptions{Platform: tc.platform})
|
||||
assert.NilError(t, err)
|
||||
|
||||
inspect, err := client.ImageInspect(ctx, reference)
|
||||
inspect, err := apiClient.ImageInspect(ctx, reference)
|
||||
assert.NilError(t, err)
|
||||
assert.Equal(t, inspect.Os, tc.expected.OS)
|
||||
assert.Equal(t, inspect.Architecture, tc.expected.Architecture)
|
||||
@@ -128,7 +128,7 @@ func TestImportWithCustomPlatformReject(t *testing.T) {
|
||||
|
||||
ctx := setupTest(t)
|
||||
|
||||
client := testEnv.APIClient()
|
||||
apiClient := testEnv.APIClient()
|
||||
|
||||
// Construct an empty tar archive.
|
||||
var tarBuffer bytes.Buffer
|
||||
@@ -172,10 +172,10 @@ func TestImportWithCustomPlatformReject(t *testing.T) {
|
||||
t.Run(tc.platform, func(t *testing.T) {
|
||||
ctx := testutil.StartSpan(ctx, t)
|
||||
reference := "import-with-platform:tc-" + strconv.Itoa(i)
|
||||
_, err = client.ImageImport(ctx,
|
||||
imagetypes.ImportSource{Source: imageRdr, SourceName: "-"},
|
||||
_, err = apiClient.ImageImport(ctx,
|
||||
client.ImageImportSource{Source: imageRdr, SourceName: "-"},
|
||||
reference,
|
||||
imagetypes.ImportOptions{Platform: tc.platform})
|
||||
client.ImageImportOptions{Platform: tc.platform})
|
||||
|
||||
assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
|
||||
assert.Check(t, is.ErrorContains(err, tc.expectedErr))
|
||||
|
||||
@@ -5,7 +5,6 @@ import (
|
||||
"encoding/json"
|
||||
"testing"
|
||||
|
||||
"github.com/moby/moby/api/types/image"
|
||||
"github.com/moby/moby/client"
|
||||
iimage "github.com/moby/moby/v2/integration/internal/image"
|
||||
"github.com/moby/moby/v2/internal/testutils/specialimage"
|
||||
@@ -55,7 +54,7 @@ func TestImageInspectUniqueRepoDigests(t *testing.T) {
|
||||
err := apiClient.ImageTag(ctx, "busybox", imgName)
|
||||
assert.NilError(t, err)
|
||||
defer func() {
|
||||
_, _ = apiClient.ImageRemove(ctx, imgName, image.RemoveOptions{Force: true})
|
||||
_, _ = apiClient.ImageRemove(ctx, imgName, client.ImageRemoveOptions{Force: true})
|
||||
}()
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ func TestImagesFilterMultiReference(t *testing.T) {
|
||||
filter.Add("reference", repoTags[0])
|
||||
filter.Add("reference", repoTags[1])
|
||||
filter.Add("reference", repoTags[2])
|
||||
options := image.ListOptions{
|
||||
options := client.ImageListOptions{
|
||||
Filters: filter,
|
||||
}
|
||||
images, err := apiClient.ImageList(ctx, options)
|
||||
@@ -96,7 +96,7 @@ func TestImagesFilterUntil(t *testing.T) {
|
||||
filters.Arg("until", laterUntil),
|
||||
filters.Arg("before", imgs[len(imgs)-1]),
|
||||
)
|
||||
list, err := apiClient.ImageList(ctx, image.ListOptions{Filters: filter})
|
||||
list, err := apiClient.ImageList(ctx, client.ImageListOptions{Filters: filter})
|
||||
assert.NilError(t, err)
|
||||
|
||||
var listedIDs []string
|
||||
@@ -130,7 +130,7 @@ func TestImagesFilterBeforeSince(t *testing.T) {
|
||||
filters.Arg("since", imgs[0]),
|
||||
filters.Arg("before", imgs[len(imgs)-1]),
|
||||
)
|
||||
list, err := apiClient.ImageList(ctx, image.ListOptions{Filters: filter})
|
||||
list, err := apiClient.ImageList(ctx, client.ImageListOptions{Filters: filter})
|
||||
assert.NilError(t, err)
|
||||
|
||||
var listedIDs []string
|
||||
@@ -191,7 +191,7 @@ func TestAPIImagesFilters(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
ctx := testutil.StartSpan(ctx, t)
|
||||
images, err := apiClient.ImageList(ctx, image.ListOptions{
|
||||
images, err := apiClient.ImageList(ctx, client.ImageListOptions{
|
||||
Filters: filters.NewArgs(tc.filters...),
|
||||
})
|
||||
assert.Check(t, err)
|
||||
@@ -228,7 +228,7 @@ func TestAPIImagesListSizeShared(t *testing.T) {
|
||||
})
|
||||
})
|
||||
|
||||
_, err := apiClient.ImageList(ctx, image.ListOptions{SharedSize: true})
|
||||
_, err := apiClient.ImageList(ctx, client.ImageListOptions{SharedSize: true})
|
||||
assert.NilError(t, err)
|
||||
}
|
||||
|
||||
@@ -265,7 +265,7 @@ func TestAPIImagesListManifests(t *testing.T) {
|
||||
// TODO: Remove when MinSupportedAPIVersion >= 1.47
|
||||
c := d.NewClientT(t, client.WithVersion(api.MinSupportedAPIVersion))
|
||||
|
||||
images, err := c.ImageList(ctx, image.ListOptions{Manifests: true})
|
||||
images, err := c.ImageList(ctx, client.ImageListOptions{Manifests: true})
|
||||
assert.NilError(t, err)
|
||||
|
||||
assert.Assert(t, is.Len(images, 1))
|
||||
@@ -277,14 +277,14 @@ func TestAPIImagesListManifests(t *testing.T) {
|
||||
api147 := d.NewClientT(t, client.WithVersion("1.47"))
|
||||
|
||||
t.Run("no manifests if not requested", func(t *testing.T) {
|
||||
images, err := api147.ImageList(ctx, image.ListOptions{})
|
||||
images, err := api147.ImageList(ctx, client.ImageListOptions{})
|
||||
assert.NilError(t, err)
|
||||
|
||||
assert.Assert(t, is.Len(images, 1))
|
||||
assert.Check(t, is.Nil(images[0].Manifests))
|
||||
})
|
||||
|
||||
images, err := api147.ImageList(ctx, image.ListOptions{Manifests: true})
|
||||
images, err := api147.ImageList(ctx, client.ImageListOptions{Manifests: true})
|
||||
assert.NilError(t, err)
|
||||
|
||||
assert.Check(t, is.Len(images, 1))
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
|
||||
cerrdefs "github.com/containerd/errdefs"
|
||||
"github.com/moby/moby/api/types/image"
|
||||
"github.com/moby/moby/client"
|
||||
iimage "github.com/moby/moby/v2/integration/internal/image"
|
||||
"github.com/moby/moby/v2/internal/testutils/specialimage"
|
||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
@@ -19,16 +20,16 @@ func TestLoadDanglingImages(t *testing.T) {
|
||||
|
||||
ctx := setupTest(t)
|
||||
|
||||
client := testEnv.APIClient()
|
||||
apiClient := testEnv.APIClient()
|
||||
|
||||
iimage.Load(ctx, t, client, func(dir string) (*ocispec.Index, error) {
|
||||
iimage.Load(ctx, t, apiClient, func(dir string) (*ocispec.Index, error) {
|
||||
return specialimage.MultiLayerCustom(dir, "namedimage:latest", []specialimage.SingleFileLayer{
|
||||
{Name: "bar", Content: []byte("1")},
|
||||
})
|
||||
})
|
||||
|
||||
// Should be one image.
|
||||
images, err := client.ImageList(ctx, image.ListOptions{})
|
||||
images, err := apiClient.ImageList(ctx, client.ImageListOptions{})
|
||||
assert.NilError(t, err)
|
||||
|
||||
findImageByName := func(images []image.Summary, imageName string) (image.Summary, error) {
|
||||
@@ -45,13 +46,13 @@ func TestLoadDanglingImages(t *testing.T) {
|
||||
assert.NilError(t, err)
|
||||
|
||||
// Retain a copy of the old image and then replace it with a new one.
|
||||
iimage.Load(ctx, t, client, func(dir string) (*ocispec.Index, error) {
|
||||
iimage.Load(ctx, t, apiClient, func(dir string) (*ocispec.Index, error) {
|
||||
return specialimage.MultiLayerCustom(dir, "namedimage:latest", []specialimage.SingleFileLayer{
|
||||
{Name: "bar", Content: []byte("2")},
|
||||
})
|
||||
})
|
||||
|
||||
images, err = client.ImageList(ctx, image.ListOptions{})
|
||||
images, err = apiClient.ImageList(ctx, client.ImageListOptions{})
|
||||
assert.NilError(t, err)
|
||||
|
||||
newImage, err := findImageByName(images, "namedimage:latest")
|
||||
|
||||
@@ -82,7 +82,7 @@ func TestPruneLexographicalOrder(t *testing.T) {
|
||||
err = apiClient.ImageTag(ctx, id, "busybox:z")
|
||||
assert.NilError(t, err)
|
||||
|
||||
_, err = apiClient.ImageRemove(ctx, "busybox:latest", image.RemoveOptions{Force: true})
|
||||
_, err = apiClient.ImageRemove(ctx, "busybox:latest", client.ImageRemoveOptions{Force: true})
|
||||
assert.NilError(t, err)
|
||||
|
||||
// run container
|
||||
|
||||
@@ -17,7 +17,7 @@ import (
|
||||
"github.com/containerd/containerd/v2/plugins/content/local"
|
||||
cerrdefs "github.com/containerd/errdefs"
|
||||
"github.com/containerd/platforms"
|
||||
"github.com/moby/moby/api/types/image"
|
||||
"github.com/moby/moby/client"
|
||||
"github.com/moby/moby/v2/testutil/daemon"
|
||||
"github.com/moby/moby/v2/testutil/registry"
|
||||
"github.com/opencontainers/go-digest"
|
||||
@@ -31,9 +31,9 @@ import (
|
||||
func TestImagePullPlatformInvalid(t *testing.T) {
|
||||
ctx := setupTest(t)
|
||||
|
||||
client := testEnv.APIClient()
|
||||
apiClient := testEnv.APIClient()
|
||||
|
||||
_, err := client.ImagePull(ctx, "docker.io/library/hello-world:latest", image.PullOptions{Platform: "foobar"})
|
||||
_, err := apiClient.ImagePull(ctx, "docker.io/library/hello-world:latest", client.ImagePullOptions{Platform: "foobar"})
|
||||
assert.Assert(t, err != nil)
|
||||
assert.Check(t, is.ErrorContains(err, "unknown operating system or architecture"))
|
||||
assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
|
||||
@@ -144,15 +144,15 @@ func TestImagePullStoredDigestForOtherRepo(t *testing.T) {
|
||||
err = c8dClient.Push(ctx, remote, desc)
|
||||
assert.NilError(t, err)
|
||||
|
||||
client := testEnv.APIClient()
|
||||
rdr, err := client.ImagePull(ctx, remote, image.PullOptions{})
|
||||
apiClient := testEnv.APIClient()
|
||||
rdr, err := apiClient.ImagePull(ctx, remote, client.ImagePullOptions{})
|
||||
assert.NilError(t, err)
|
||||
defer rdr.Close()
|
||||
_, err = io.Copy(io.Discard, rdr)
|
||||
assert.Check(t, err)
|
||||
|
||||
// Now, pull a totally different repo with a the same digest
|
||||
rdr, err = client.ImagePull(ctx, path.Join(registry.DefaultURL, "other:image@"+desc.Digest.String()), image.PullOptions{})
|
||||
rdr, err = apiClient.ImagePull(ctx, path.Join(registry.DefaultURL, "other:image@"+desc.Digest.String()), client.ImagePullOptions{})
|
||||
if rdr != nil {
|
||||
assert.Check(t, rdr.Close())
|
||||
}
|
||||
@@ -178,8 +178,8 @@ func TestImagePullNonExisting(t *testing.T) {
|
||||
t.Run(ref, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
client := testEnv.APIClient()
|
||||
rdr, err := client.ImagePull(ctx, ref, image.PullOptions{
|
||||
apiClient := testEnv.APIClient()
|
||||
rdr, err := apiClient.ImagePull(ctx, ref, client.ImagePullOptions{
|
||||
All: all,
|
||||
})
|
||||
if err == nil {
|
||||
@@ -218,10 +218,10 @@ func TestImagePullKeepOldAsDangling(t *testing.T) {
|
||||
|
||||
assert.NilError(t, apiClient.ImageTag(ctx, "busybox:latest", "alpine:latest"))
|
||||
|
||||
_, err = apiClient.ImageRemove(ctx, "busybox:latest", image.RemoveOptions{})
|
||||
_, err = apiClient.ImageRemove(ctx, "busybox:latest", client.ImageRemoveOptions{})
|
||||
assert.NilError(t, err)
|
||||
|
||||
rc, err := apiClient.ImagePull(ctx, "alpine:latest", image.PullOptions{})
|
||||
rc, err := apiClient.ImagePull(ctx, "alpine:latest", client.ImagePullOptions{})
|
||||
assert.NilError(t, err)
|
||||
|
||||
defer rc.Close()
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
|
||||
containertypes "github.com/moby/moby/api/types/container"
|
||||
"github.com/moby/moby/api/types/image"
|
||||
"github.com/moby/moby/client"
|
||||
"github.com/moby/moby/v2/integration/internal/container"
|
||||
iimage "github.com/moby/moby/v2/integration/internal/image"
|
||||
"github.com/moby/moby/v2/internal/testutils/specialimage"
|
||||
@@ -21,47 +22,47 @@ import (
|
||||
func TestRemoveImageOrphaning(t *testing.T) {
|
||||
ctx := setupTest(t)
|
||||
|
||||
client := testEnv.APIClient()
|
||||
apiClient := testEnv.APIClient()
|
||||
|
||||
imgName := strings.ToLower(t.Name())
|
||||
|
||||
// Create a container from busybox, and commit a small change so we have a new image
|
||||
cID1 := container.Create(ctx, t, client, container.WithCmd(""))
|
||||
commitResp1, err := client.ContainerCommit(ctx, cID1, containertypes.CommitOptions{
|
||||
cID1 := container.Create(ctx, t, apiClient, container.WithCmd(""))
|
||||
commitResp1, err := apiClient.ContainerCommit(ctx, cID1, containertypes.CommitOptions{
|
||||
Changes: []string{`ENTRYPOINT ["true"]`},
|
||||
Reference: imgName,
|
||||
})
|
||||
assert.NilError(t, err)
|
||||
|
||||
// verifies that reference now points to first image
|
||||
resp, err := client.ImageInspect(ctx, imgName)
|
||||
resp, err := apiClient.ImageInspect(ctx, imgName)
|
||||
assert.NilError(t, err)
|
||||
assert.Check(t, is.Equal(resp.ID, commitResp1.ID))
|
||||
|
||||
// Create a container from created image, and commit a small change with same reference name
|
||||
cID2 := container.Create(ctx, t, client, container.WithImage(imgName), container.WithCmd(""))
|
||||
commitResp2, err := client.ContainerCommit(ctx, cID2, containertypes.CommitOptions{
|
||||
cID2 := container.Create(ctx, t, apiClient, container.WithImage(imgName), container.WithCmd(""))
|
||||
commitResp2, err := apiClient.ContainerCommit(ctx, cID2, containertypes.CommitOptions{
|
||||
Changes: []string{`LABEL Maintainer="Integration Tests"`},
|
||||
Reference: imgName,
|
||||
})
|
||||
assert.NilError(t, err)
|
||||
|
||||
// verifies that reference now points to second image
|
||||
resp, err = client.ImageInspect(ctx, imgName)
|
||||
resp, err = apiClient.ImageInspect(ctx, imgName)
|
||||
assert.NilError(t, err)
|
||||
assert.Check(t, is.Equal(resp.ID, commitResp2.ID))
|
||||
|
||||
// try to remove the image, should not error out.
|
||||
_, err = client.ImageRemove(ctx, imgName, image.RemoveOptions{})
|
||||
_, err = apiClient.ImageRemove(ctx, imgName, client.ImageRemoveOptions{})
|
||||
assert.NilError(t, err)
|
||||
|
||||
// check if the first image is still there
|
||||
resp, err = client.ImageInspect(ctx, commitResp1.ID)
|
||||
resp, err = apiClient.ImageInspect(ctx, commitResp1.ID)
|
||||
assert.NilError(t, err)
|
||||
assert.Check(t, is.Equal(resp.ID, commitResp1.ID))
|
||||
|
||||
// check if the second image has been deleted
|
||||
_, err = client.ImageInspect(ctx, commitResp2.ID)
|
||||
_, err = apiClient.ImageInspect(ctx, commitResp2.ID)
|
||||
assert.Check(t, is.ErrorContains(err, "No such image:"))
|
||||
}
|
||||
|
||||
@@ -69,12 +70,12 @@ func TestRemoveByDigest(t *testing.T) {
|
||||
skip.If(t, !testEnv.UsingSnapshotter(), "RepoDigests doesn't include tags when using graphdrivers")
|
||||
|
||||
ctx := setupTest(t)
|
||||
client := testEnv.APIClient()
|
||||
apiClient := testEnv.APIClient()
|
||||
|
||||
err := client.ImageTag(ctx, "busybox", "test-remove-by-digest:latest")
|
||||
err := apiClient.ImageTag(ctx, "busybox", "test-remove-by-digest:latest")
|
||||
assert.NilError(t, err)
|
||||
|
||||
inspect, err := client.ImageInspect(ctx, "test-remove-by-digest")
|
||||
inspect, err := apiClient.ImageInspect(ctx, "test-remove-by-digest")
|
||||
assert.NilError(t, err)
|
||||
|
||||
id := ""
|
||||
@@ -86,13 +87,13 @@ func TestRemoveByDigest(t *testing.T) {
|
||||
}
|
||||
assert.Assert(t, id != "")
|
||||
|
||||
_, err = client.ImageRemove(ctx, id, image.RemoveOptions{})
|
||||
_, err = apiClient.ImageRemove(ctx, id, client.ImageRemoveOptions{})
|
||||
assert.NilError(t, err, "error removing %s", id)
|
||||
|
||||
_, err = client.ImageInspect(ctx, "busybox")
|
||||
_, err = apiClient.ImageInspect(ctx, "busybox")
|
||||
assert.NilError(t, err, "busybox image got deleted")
|
||||
|
||||
inspect, err = client.ImageInspect(ctx, "test-remove-by-digest")
|
||||
inspect, err = apiClient.ImageInspect(ctx, "test-remove-by-digest")
|
||||
assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
|
||||
assert.Check(t, is.DeepEqual(inspect, image.InspectResponse{}))
|
||||
}
|
||||
@@ -142,7 +143,7 @@ func TestRemoveWithPlatform(t *testing.T) {
|
||||
{&platformHost, descs[0]},
|
||||
{&someOtherPlatform, descs[3]},
|
||||
} {
|
||||
resp, err := apiClient.ImageRemove(ctx, imgName, image.RemoveOptions{
|
||||
resp, err := apiClient.ImageRemove(ctx, imgName, client.ImageRemoveOptions{
|
||||
Platforms: []ocispec.Platform{*tc.platform},
|
||||
Force: true,
|
||||
})
|
||||
@@ -155,7 +156,7 @@ func TestRemoveWithPlatform(t *testing.T) {
|
||||
}
|
||||
|
||||
// Delete the rest
|
||||
resp, err := apiClient.ImageRemove(ctx, imgName, image.RemoveOptions{})
|
||||
resp, err := apiClient.ImageRemove(ctx, imgName, client.ImageRemoveOptions{})
|
||||
assert.NilError(t, err)
|
||||
|
||||
assert.Check(t, is.Len(resp, 2))
|
||||
|
||||
@@ -16,7 +16,6 @@ import (
|
||||
"github.com/cpuguy83/tar2go"
|
||||
"github.com/moby/go-archive/compression"
|
||||
containertypes "github.com/moby/moby/api/types/container"
|
||||
"github.com/moby/moby/api/types/image"
|
||||
"github.com/moby/moby/api/types/versions"
|
||||
"github.com/moby/moby/client"
|
||||
"github.com/moby/moby/v2/integration/internal/build"
|
||||
@@ -315,7 +314,7 @@ func TestSaveAndLoadPlatform(t *testing.T) {
|
||||
t.Run(tc.testName, func(t *testing.T) {
|
||||
// pull the image
|
||||
for _, p := range tc.pullPlatforms {
|
||||
resp, err := apiClient.ImagePull(ctx, repoName, image.PullOptions{Platform: p})
|
||||
resp, err := apiClient.ImagePull(ctx, repoName, client.ImagePullOptions{Platform: p})
|
||||
assert.NilError(t, err)
|
||||
_, err = io.ReadAll(resp)
|
||||
resp.Close()
|
||||
@@ -327,7 +326,7 @@ func TestSaveAndLoadPlatform(t *testing.T) {
|
||||
assert.NilError(t, err)
|
||||
|
||||
// remove the pulled image
|
||||
_, err = apiClient.ImageRemove(ctx, repoName, image.RemoveOptions{})
|
||||
_, err = apiClient.ImageRemove(ctx, repoName, client.ImageRemoveOptions{})
|
||||
assert.NilError(t, err)
|
||||
|
||||
// load the full exported image (all platforms in it)
|
||||
@@ -348,12 +347,12 @@ func TestSaveAndLoadPlatform(t *testing.T) {
|
||||
}
|
||||
|
||||
// remove the loaded image
|
||||
_, err = apiClient.ImageRemove(ctx, repoName, image.RemoveOptions{})
|
||||
_, err = apiClient.ImageRemove(ctx, repoName, client.ImageRemoveOptions{})
|
||||
assert.NilError(t, err)
|
||||
|
||||
// pull the image again (start fresh)
|
||||
for _, p := range tc.pullPlatforms {
|
||||
resp, err := apiClient.ImagePull(ctx, repoName, image.PullOptions{Platform: p})
|
||||
resp, err := apiClient.ImagePull(ctx, repoName, client.ImagePullOptions{Platform: p})
|
||||
assert.NilError(t, err)
|
||||
_, err = io.ReadAll(resp)
|
||||
resp.Close()
|
||||
@@ -365,7 +364,7 @@ func TestSaveAndLoadPlatform(t *testing.T) {
|
||||
assert.NilError(t, err)
|
||||
|
||||
// remove the pulled image
|
||||
_, err = apiClient.ImageRemove(ctx, repoName, image.RemoveOptions{})
|
||||
_, err = apiClient.ImageRemove(ctx, repoName, client.ImageRemoveOptions{})
|
||||
assert.NilError(t, err)
|
||||
|
||||
// load the exported image on the specified platforms only
|
||||
|
||||
Reference in New Issue
Block a user