Skip to content

Commit

Permalink
fix: Allow to delete images when names of images are short digest ids…
Browse files Browse the repository at this point in the history
… of another images

    Fix cmd/nerdctl/image/image_remove_test.go to run on the Windows environment based on the review.

Signed-off-by: Hayato Kiwata <[email protected]>
  • Loading branch information
haytok committed Oct 19, 2024
1 parent 384209f commit 5da8521
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions cmd/nerdctl/image/image_remove_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,24 +317,21 @@ func TestIssue3016(t *testing.T) {
testCase.SubTests = []*test.Case{
{
Description: "Issue #3016 - Tags created using the short digest ids of container images cannot be deleted using the nerdctl rmi command.",
Require: test.Require(
test.Not(test.Windows),
),
Setup: func(data test.Data, helpers test.Helpers) {
helpers.Ensure("pull", testutil.AlpineImage)
helpers.Ensure("pull", testutil.BusyboxImage)
helpers.Ensure("pull", testutil.CommonImage)
helpers.Ensure("pull", testutil.NginxAlpineImage)

img := nerdtest.InspectImage(helpers, testutil.BusyboxImage)
repoName, _ := imgutil.ParseRepoTag(testutil.BusyboxImage)
img := nerdtest.InspectImage(helpers, testutil.NginxAlpineImage)
repoName, _ := imgutil.ParseRepoTag(testutil.NginxAlpineImage)
tagID := strings.TrimPrefix(img.RepoDigests[0], repoName+"@sha256:")[0:8]

helpers.Ensure("tag", testutil.AlpineImage, tagID)
helpers.Ensure("tag", testutil.CommonImage, tagID)

data.Set(tagIDKey, tagID)
},
Cleanup: func(data test.Data, helpers test.Helpers) {
helpers.Anyhow("rmi", "-f", testutil.AlpineImage)
helpers.Anyhow("rmi", "-f", testutil.BusyboxImage)
helpers.Anyhow("rmi", "-f", testutil.CommonImage)
helpers.Anyhow("rmi", "-f", testutil.NginxAlpineImage)
},
Command: func(data test.Data, helpers test.Helpers) test.TestableCommand {
return helpers.Command("rmi", data.Get(tagIDKey))
Expand Down

0 comments on commit 5da8521

Please sign in to comment.