Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -35,5 +35,5 @@ func (cli *Client) ImageRemove(ctx context.Context, imageID string, options Imag |
| 35 | 35 |
|
| 36 | 36 |
var dels []image.DeleteResponse |
| 37 | 37 |
err = json.NewDecoder(resp.Body).Decode(&dels) |
| 38 |
- return ImageRemoveResult{Deleted: dels}, err
|
|
| 38 |
+ return ImageRemoveResult{Items: dels}, err
|
|
| 39 | 39 |
} |
| ... | ... |
@@ -91,8 +91,8 @@ func TestImageRemove(t *testing.T) {
|
| 91 | 91 |
opts.Platforms = []ocispec.Platform{*removeCase.platform}
|
| 92 | 92 |
} |
| 93 | 93 |
|
| 94 |
- imageDeletes, err := client.ImageRemove(context.Background(), "image_id", opts) |
|
| 94 |
+ res, err := client.ImageRemove(context.Background(), "image_id", opts) |
|
| 95 | 95 |
assert.NilError(t, err) |
| 96 |
- assert.Check(t, is.Len(imageDeletes.Deleted, 2)) |
|
| 96 |
+ assert.Check(t, is.Len(res.Items, 2)) |
|
| 97 | 97 |
} |
| 98 | 98 |
} |
| ... | ... |
@@ -802,7 +802,7 @@ func TestBuildHistoryDoesNotPreventRemoval(t *testing.T) {
|
| 802 | 802 |
|
| 803 | 803 |
res, err := apiClient.ImageRemove(ctx, "history-a", client.ImageRemoveOptions{})
|
| 804 | 804 |
assert.NilError(t, err) |
| 805 |
- assert.Check(t, slices.ContainsFunc(res.Deleted, func(r image.DeleteResponse) bool {
|
|
| 805 |
+ assert.Check(t, slices.ContainsFunc(res.Items, func(r image.DeleteResponse) bool {
|
|
| 806 | 806 |
return r.Deleted != "" |
| 807 | 807 |
})) |
| 808 | 808 |
} |
| ... | ... |
@@ -78,7 +78,7 @@ func TestAPIImageHistoryCrossPlatform(t *testing.T) {
|
| 78 | 78 |
|
| 79 | 79 |
imgID := build.GetImageIDFromBody(t, resp.Body) |
| 80 | 80 |
t.Cleanup(func() {
|
| 81 |
- apiClient.ImageRemove(ctx, imgID, client.ImageRemoveOptions{Force: true})
|
|
| 81 |
+ _, _ = apiClient.ImageRemove(ctx, imgID, client.ImageRemoveOptions{Force: true})
|
|
| 82 | 82 |
}) |
| 83 | 83 |
|
| 84 | 84 |
testCases := []struct {
|
| ... | ... |
@@ -147,20 +147,20 @@ func TestRemoveWithPlatform(t *testing.T) {
|
| 147 | 147 |
Force: true, |
| 148 | 148 |
}) |
| 149 | 149 |
assert.NilError(t, err) |
| 150 |
- assert.Check(t, is.Len(res.Deleted, 1)) |
|
| 151 |
- for _, r := range res.Deleted {
|
|
| 150 |
+ assert.Check(t, is.Len(res.Items, 1)) |
|
| 151 |
+ for _, r := range res.Items {
|
|
| 152 | 152 |
assert.Check(t, is.Equal(r.Untagged, ""), "No image should be untagged") |
| 153 | 153 |
} |
| 154 |
- checkPlatformDeleted(t, imageIdx, res.Deleted, tc.deleted) |
|
| 154 |
+ checkPlatformDeleted(t, imageIdx, res.Items, tc.deleted) |
|
| 155 | 155 |
} |
| 156 | 156 |
|
| 157 | 157 |
// Delete the rest |
| 158 | 158 |
resp, err := apiClient.ImageRemove(ctx, imgName, client.ImageRemoveOptions{})
|
| 159 | 159 |
assert.NilError(t, err) |
| 160 | 160 |
|
| 161 |
- assert.Check(t, is.Len(resp.Deleted, 2)) |
|
| 162 |
- assert.Check(t, is.Equal(resp.Deleted[0].Untagged, imgName)) |
|
| 163 |
- assert.Check(t, is.Equal(resp.Deleted[1].Deleted, imageIdx.Manifests[0].Digest.String())) |
|
| 161 |
+ assert.Check(t, is.Len(resp.Items, 2)) |
|
| 162 |
+ assert.Check(t, is.Equal(resp.Items[0].Untagged, imgName)) |
|
| 163 |
+ assert.Check(t, is.Equal(resp.Items[1].Deleted, imageIdx.Manifests[0].Digest.String())) |
|
| 164 | 164 |
// TODO(vvoland): Should it also include platform-specific manifests? https://github.com/moby/moby/pull/49982 |
| 165 | 165 |
} |
| 166 | 166 |
|
| ... | ... |
@@ -19,13 +19,13 @@ import ( |
| 19 | 19 |
// Do builds an image from the given context and returns the image ID. |
| 20 | 20 |
func Do(ctx context.Context, t *testing.T, apiClient client.APIClient, buildCtx *fakecontext.Fake) string {
|
| 21 | 21 |
resp, err := apiClient.ImageBuild(ctx, buildCtx.AsTarReader(t), client.ImageBuildOptions{})
|
| 22 |
+ assert.NilError(t, err) |
|
| 22 | 23 |
if resp.Body != nil {
|
| 23 | 24 |
defer resp.Body.Close() |
| 24 | 25 |
} |
| 25 |
- assert.NilError(t, err) |
|
| 26 | 26 |
img := GetImageIDFromBody(t, resp.Body) |
| 27 | 27 |
t.Cleanup(func() {
|
| 28 |
- apiClient.ImageRemove(ctx, img, client.ImageRemoveOptions{Force: true})
|
|
| 28 |
+ _, _ = apiClient.ImageRemove(ctx, img, client.ImageRemoveOptions{Force: true})
|
|
| 29 | 29 |
}) |
| 30 | 30 |
return img |
| 31 | 31 |
} |
| ... | ... |
@@ -151,7 +151,9 @@ func TestRunMountImage(t *testing.T) {
|
| 151 | 151 |
t.Run(tc.name, func(t *testing.T) {
|
| 152 | 152 |
testImage := setupTestImage(t, ctx, apiClient, tc.name) |
| 153 | 153 |
if testImage != "" {
|
| 154 |
- defer apiClient.ImageRemove(ctx, testImage, client.ImageRemoveOptions{Force: true})
|
|
| 154 |
+ defer func() {
|
|
| 155 |
+ _, _ = apiClient.ImageRemove(ctx, testImage, client.ImageRemoveOptions{Force: true})
|
|
| 156 |
+ }() |
|
| 155 | 157 |
} |
| 156 | 158 |
|
| 157 | 159 |
cfg := containertypes.Config{
|
| ... | ... |
@@ -35,5 +35,5 @@ func (cli *Client) ImageRemove(ctx context.Context, imageID string, options Imag |
| 35 | 35 |
|
| 36 | 36 |
var dels []image.DeleteResponse |
| 37 | 37 |
err = json.NewDecoder(resp.Body).Decode(&dels) |
| 38 |
- return ImageRemoveResult{Deleted: dels}, err
|
|
| 38 |
+ return ImageRemoveResult{Items: dels}, err
|
|
| 39 | 39 |
} |