Skip to content

Commit c661d16

Browse files
committed
Fix broken TestImageInspectDifferentValidReferencesForTheSameImage
As of 10/01/2024, busybox latest tag (1.37.0) is no longer the same thing as stable (1.36.1). It is unclear if that was made on purpose, or a problem with Docker publication process. Signed-off-by: apostasie <[email protected]>
1 parent b943664 commit c661d16

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

cmd/nerdctl/image/image_inspect_test.go

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ package image
1818

1919
import (
2020
"encoding/json"
21-
"runtime"
2221
"strings"
2322
"testing"
2423

@@ -71,16 +70,12 @@ func TestImageInspectSimpleCases(t *testing.T) {
7170
func TestImageInspectDifferentValidReferencesForTheSameImage(t *testing.T) {
7271
nerdtest.Setup()
7372

74-
platform := runtime.GOOS + "/" + runtime.GOARCH
75-
7673
tags := []string{
7774
"",
7875
":latest",
79-
":stable",
8076
}
8177
names := []string{
8278
"busybox",
83-
"library/busybox",
8479
"docker.io/library/busybox",
8580
"registry-1.docker.io/library/busybox",
8681
}
@@ -94,11 +89,9 @@ func TestImageInspectDifferentValidReferencesForTheSameImage(t *testing.T) {
9489
nerdtest.Private,
9590
),
9691
Setup: func(data test.Data, helpers test.Helpers) {
97-
helpers.Ensure("pull", "alpine", "--platform", platform)
98-
helpers.Ensure("pull", "busybox", "--platform", platform)
99-
helpers.Ensure("pull", "busybox:stable", "--platform", platform)
100-
helpers.Ensure("pull", "registry-1.docker.io/library/busybox", "--platform", platform)
101-
helpers.Ensure("pull", "registry-1.docker.io/library/busybox:stable", "--platform", platform)
92+
helpers.Ensure("pull", "alpine")
93+
helpers.Ensure("pull", "busybox")
94+
helpers.Ensure("pull", "registry-1.docker.io/library/busybox")
10295
},
10396
SubTests: []*test.Case{
10497
{
@@ -150,9 +143,11 @@ func TestImageInspectDifferentValidReferencesForTheSameImage(t *testing.T) {
150143

151144
// Demonstrate image name precedence over digest lookup
152145
// Using the shortened sha should no longer get busybox, but rather the newly tagged Alpine
146+
// FIXME: this is triggering https://github.com/containerd/nerdctl/issues/3016
147+
// We cannot get rid of that image now, which does break local testing
153148
helpers.Ensure("tag", "alpine", sha[0:8])
154149
it := nerdtest.InspectImage(helpers, sha[0:8])
155-
assert.Equal(t, it.ID, alpine.ID, alpine.ID+" vs "+it.ID)
150+
assert.Equal(t, it.ID, alpine.ID)
156151
},
157152
}
158153
},
@@ -202,18 +197,17 @@ func TestImageInspectDifferentValidReferencesForTheSameImage(t *testing.T) {
202197
},
203198
{
204199
Description: "retrieving multiple entries at once",
205-
Command: test.RunCommand("image", "inspect", "busybox", "busybox", "busybox:stable"),
200+
Command: test.RunCommand("image", "inspect", "busybox", "busybox"),
206201
Expected: func(data test.Data, helpers test.Helpers) *test.Expected {
207202
return &test.Expected{
208203
Output: func(stdout string, info string, t *testing.T) {
209204
var dc []dockercompat.Image
210205
err := json.Unmarshal([]byte(stdout), &dc)
211206
assert.NilError(t, err, "Unable to unmarshal output\n"+info)
212-
assert.Equal(t, 3, len(dc), "Unexpectedly did not get 3 results\n"+info)
207+
assert.Equal(t, 2, len(dc), "Unexpectedly did not get 2 results\n"+info)
213208
reference := nerdtest.InspectImage(helpers, "busybox")
214209
assert.Equal(t, dc[0].ID, reference.ID)
215210
assert.Equal(t, dc[1].ID, reference.ID)
216-
assert.Equal(t, dc[2].ID, reference.ID)
217211
},
218212
}
219213
},

0 commit comments

Comments
 (0)