mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
client: rename ImageRemoveResult.Deleted to ImageRemoveResult.Items
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -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 != ""
|
||||
}))
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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{
|
||||
|
||||
Reference in New Issue
Block a user