diff --git a/client/image_remove.go b/client/image_remove.go index 17ed75741c..095b4f04c4 100644 --- a/client/image_remove.go +++ b/client/image_remove.go @@ -35,5 +35,5 @@ func (cli *Client) ImageRemove(ctx context.Context, imageID string, options Imag var dels []image.DeleteResponse err = json.NewDecoder(resp.Body).Decode(&dels) - return ImageRemoveResult{Deleted: dels}, err + return ImageRemoveResult{Items: dels}, err } diff --git a/client/image_remove_opts.go b/client/image_remove_opts.go index d028f46086..3b5d8a77f7 100644 --- a/client/image_remove_opts.go +++ b/client/image_remove_opts.go @@ -14,5 +14,5 @@ type ImageRemoveOptions struct { // ImageRemoveResult holds the delete responses returned by the daemon. type ImageRemoveResult struct { - Deleted []image.DeleteResponse + Items []image.DeleteResponse } diff --git a/client/image_remove_test.go b/client/image_remove_test.go index 0c2934a3a4..cb3b3b677d 100644 --- a/client/image_remove_test.go +++ b/client/image_remove_test.go @@ -91,8 +91,8 @@ func TestImageRemove(t *testing.T) { opts.Platforms = []ocispec.Platform{*removeCase.platform} } - imageDeletes, err := client.ImageRemove(context.Background(), "image_id", opts) + res, err := client.ImageRemove(context.Background(), "image_id", opts) assert.NilError(t, err) - assert.Check(t, is.Len(imageDeletes.Deleted, 2)) + assert.Check(t, is.Len(res.Items, 2)) } } diff --git a/integration/build/build_test.go b/integration/build/build_test.go index e45c560166..e27b7de442 100644 --- a/integration/build/build_test.go +++ b/integration/build/build_test.go @@ -802,7 +802,7 @@ func TestBuildHistoryDoesNotPreventRemoval(t *testing.T) { res, err := apiClient.ImageRemove(ctx, "history-a", client.ImageRemoveOptions{}) assert.NilError(t, err) - assert.Check(t, slices.ContainsFunc(res.Deleted, func(r image.DeleteResponse) bool { + assert.Check(t, slices.ContainsFunc(res.Items, func(r image.DeleteResponse) bool { return r.Deleted != "" })) } diff --git a/integration/image/history_test.go b/integration/image/history_test.go index 5891b97bb1..d65b165a3e 100644 --- a/integration/image/history_test.go +++ b/integration/image/history_test.go @@ -78,7 +78,7 @@ func TestAPIImageHistoryCrossPlatform(t *testing.T) { imgID := build.GetImageIDFromBody(t, resp.Body) t.Cleanup(func() { - apiClient.ImageRemove(ctx, imgID, client.ImageRemoveOptions{Force: true}) + _, _ = apiClient.ImageRemove(ctx, imgID, client.ImageRemoveOptions{Force: true}) }) testCases := []struct { diff --git a/integration/image/remove_test.go b/integration/image/remove_test.go index 099d24db8c..78c436025c 100644 --- a/integration/image/remove_test.go +++ b/integration/image/remove_test.go @@ -147,20 +147,20 @@ func TestRemoveWithPlatform(t *testing.T) { Force: true, }) assert.NilError(t, err) - assert.Check(t, is.Len(res.Deleted, 1)) - for _, r := range res.Deleted { + assert.Check(t, is.Len(res.Items, 1)) + for _, r := range res.Items { assert.Check(t, is.Equal(r.Untagged, ""), "No image should be untagged") } - checkPlatformDeleted(t, imageIdx, res.Deleted, tc.deleted) + checkPlatformDeleted(t, imageIdx, res.Items, tc.deleted) } // Delete the rest resp, err := apiClient.ImageRemove(ctx, imgName, client.ImageRemoveOptions{}) assert.NilError(t, err) - assert.Check(t, is.Len(resp.Deleted, 2)) - assert.Check(t, is.Equal(resp.Deleted[0].Untagged, imgName)) - assert.Check(t, is.Equal(resp.Deleted[1].Deleted, imageIdx.Manifests[0].Digest.String())) + assert.Check(t, is.Len(resp.Items, 2)) + assert.Check(t, is.Equal(resp.Items[0].Untagged, imgName)) + assert.Check(t, is.Equal(resp.Items[1].Deleted, imageIdx.Manifests[0].Digest.String())) // TODO(vvoland): Should it also include platform-specific manifests? https://github.com/moby/moby/pull/49982 } diff --git a/integration/internal/build/build.go b/integration/internal/build/build.go index a435f42076..f21a6c60a7 100644 --- a/integration/internal/build/build.go +++ b/integration/internal/build/build.go @@ -19,13 +19,13 @@ import ( // Do builds an image from the given context and returns the image ID. func Do(ctx context.Context, t *testing.T, apiClient client.APIClient, buildCtx *fakecontext.Fake) string { resp, err := apiClient.ImageBuild(ctx, buildCtx.AsTarReader(t), client.ImageBuildOptions{}) + assert.NilError(t, err) if resp.Body != nil { defer resp.Body.Close() } - assert.NilError(t, err) img := GetImageIDFromBody(t, resp.Body) t.Cleanup(func() { - apiClient.ImageRemove(ctx, img, client.ImageRemoveOptions{Force: true}) + _, _ = apiClient.ImageRemove(ctx, img, client.ImageRemoveOptions{Force: true}) }) return img } diff --git a/integration/volume/mount_test.go b/integration/volume/mount_test.go index a371e8f8ab..d26bb8471a 100644 --- a/integration/volume/mount_test.go +++ b/integration/volume/mount_test.go @@ -151,7 +151,9 @@ func TestRunMountImage(t *testing.T) { t.Run(tc.name, func(t *testing.T) { testImage := setupTestImage(t, ctx, apiClient, tc.name) if testImage != "" { - defer apiClient.ImageRemove(ctx, testImage, client.ImageRemoveOptions{Force: true}) + defer func() { + _, _ = apiClient.ImageRemove(ctx, testImage, client.ImageRemoveOptions{Force: true}) + }() } cfg := containertypes.Config{ diff --git a/vendor/github.com/moby/moby/client/image_remove.go b/vendor/github.com/moby/moby/client/image_remove.go index 17ed75741c..095b4f04c4 100644 --- a/vendor/github.com/moby/moby/client/image_remove.go +++ b/vendor/github.com/moby/moby/client/image_remove.go @@ -35,5 +35,5 @@ func (cli *Client) ImageRemove(ctx context.Context, imageID string, options Imag var dels []image.DeleteResponse err = json.NewDecoder(resp.Body).Decode(&dels) - return ImageRemoveResult{Deleted: dels}, err + return ImageRemoveResult{Items: dels}, err } diff --git a/vendor/github.com/moby/moby/client/image_remove_opts.go b/vendor/github.com/moby/moby/client/image_remove_opts.go index d028f46086..3b5d8a77f7 100644 --- a/vendor/github.com/moby/moby/client/image_remove_opts.go +++ b/vendor/github.com/moby/moby/client/image_remove_opts.go @@ -14,5 +14,5 @@ type ImageRemoveOptions struct { // ImageRemoveResult holds the delete responses returned by the daemon. type ImageRemoveResult struct { - Deleted []image.DeleteResponse + Items []image.DeleteResponse }