Skip to content

Commit 3e3517c

Browse files
committed
Remove images from Docker Hub from tests, fix containerd#3498
Signed-off-by: apostasie <[email protected]>
1 parent 30db864 commit 3e3517c

File tree

4 files changed

+13
-10
lines changed

4 files changed

+13
-10
lines changed

cmd/nerdctl/container/container_run_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,8 +383,8 @@ func TestRunWithLogBinary(t *testing.T) {
383383
imageName := testutil.Identifier(t) + "-image"
384384
containerName := testutil.Identifier(t)
385385

386-
const dockerfile = `
387-
FROM golang:latest as builder
386+
var dockerfile = `
387+
FROM ` + testutil.GolangImage + ` as builder
388388
WORKDIR /go/src/
389389
RUN mkdir -p logger
390390
WORKDIR /go/src/logger

cmd/nerdctl/image/image_list_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,12 @@ LABEL version=0.1`, testutil.CommonImage)
9595
base.Cmd("build", "-t", tempName, "-f", buildCtx+"/Dockerfile", buildCtx).AssertOK()
9696
defer base.Cmd("rmi", tempName).AssertOK()
9797

98-
busyboxGlibc, busyboxUclibc := "busybox:glibc", "busybox:uclibc"
99-
base.Cmd("pull", busyboxGlibc).AssertOK()
100-
defer base.Cmd("rmi", busyboxGlibc).AssertOK()
101-
102-
base.Cmd("pull", busyboxUclibc).AssertOK()
103-
defer base.Cmd("rmi", busyboxUclibc).AssertOK()
98+
// This test is about testing local filtering of image names - as such, we do not need remote images at all
99+
taggedOne, taggedTwo := "taggedimage:xfoox", "taggedimage:yzfooyz"
100+
base.Cmd("tag", testutil.CommonImage, taggedOne).Run()
101+
base.Cmd("tag", testutil.CommonImage, taggedTwo).Run()
102+
defer base.Cmd("rmi", taggedOne).AssertOK()
103+
defer base.Cmd("rmi", taggedTwo).AssertOK()
104104

105105
// before/since filters are not compatible with DOCKER_BUILDKIT=1? (but still compatible with DOCKER_BUILDKIT=0)
106106
if base.Target == testutil.Nerdctl {
@@ -119,8 +119,8 @@ LABEL version=0.1`, testutil.CommonImage)
119119
base.Cmd("images", "--filter", "label=foo=bar", "--filter", "label=version=0.2").AssertOutNotContains(tempName)
120120
base.Cmd("images", "--filter", "label=version").AssertOutContains(tempName)
121121
base.Cmd("images", "--filter", fmt.Sprintf("reference=%s*", tempName)).AssertOutContains(tempName)
122-
base.Cmd("images", "--filter", "reference=busy*:*libc*").AssertOutContains("glibc")
123-
base.Cmd("images", "--filter", "reference=busy*:*libc*").AssertOutContains("uclibc")
122+
base.Cmd("images", "--filter", "reference=tag*:*foo*").AssertOutContains("xfoox")
123+
base.Cmd("images", "--filter", "reference=tag*:*foo*").AssertOutContains("yzfooyz")
124124
}
125125

126126
func TestImagesFilterDangling(t *testing.T) {

pkg/testutil/testutil_linux.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ var (
4343
FluentdImage = "fluent/fluentd:v1.17.0-debian-1.0"
4444
KuboImage = mirrorOf("ipfs/kubo:v0.16.0")
4545
SystemdImage = "ghcr.io/containerd/stargz-snapshotter:0.15.1-kind"
46+
GolangImage = mirrorOf("golang:1.18")
4647

4748
// Source: https://gist.github.com/cpuguy83/fcf3041e5d8fb1bb5c340915aabeebe0
4849
NonDistBlobImage = "ghcr.io/cpuguy83/non-dist-blob:latest"

pkg/testutil/testutil_windows.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ const (
4343
NginxAlpineImage = "registry.k8s.io/e2e-test-images/nginx:1.14-2"
4444
NginxAlpineIndexHTMLSnippet = "<title>Welcome to nginx!</title>"
4545

46+
GolangImage = "fixme-test-using-this-image-is-disabled-on-windows"
47+
4648
// This error string is expected when attempting to connect to a TCP socket
4749
// for a service which actively refuses the connection.
4850
// (e.g. attempting to connect using http to an https endpoint).

0 commit comments

Comments
 (0)