diff --git a/cmd/nerdctl/container/container_run_test.go b/cmd/nerdctl/container/container_run_test.go index d6d7f4a576f..d2e7ef79011 100644 --- a/cmd/nerdctl/container/container_run_test.go +++ b/cmd/nerdctl/container/container_run_test.go @@ -383,8 +383,8 @@ func TestRunWithLogBinary(t *testing.T) { imageName := testutil.Identifier(t) + "-image" containerName := testutil.Identifier(t) - const dockerfile = ` -FROM golang:latest as builder + var dockerfile = ` +FROM ` + testutil.GolangImage + ` as builder WORKDIR /go/src/ RUN mkdir -p logger WORKDIR /go/src/logger diff --git a/cmd/nerdctl/image/image_list_test.go b/cmd/nerdctl/image/image_list_test.go index fceb83a0426..3b3772fe292 100644 --- a/cmd/nerdctl/image/image_list_test.go +++ b/cmd/nerdctl/image/image_list_test.go @@ -95,12 +95,12 @@ LABEL version=0.1`, testutil.CommonImage) base.Cmd("build", "-t", tempName, "-f", buildCtx+"/Dockerfile", buildCtx).AssertOK() defer base.Cmd("rmi", tempName).AssertOK() - busyboxGlibc, busyboxUclibc := "busybox:glibc", "busybox:uclibc" - base.Cmd("pull", busyboxGlibc).AssertOK() - defer base.Cmd("rmi", busyboxGlibc).AssertOK() - - base.Cmd("pull", busyboxUclibc).AssertOK() - defer base.Cmd("rmi", busyboxUclibc).AssertOK() + // This test is about testing local filtering of image names - as such, we do not need remote images at all + taggedOne, taggedTwo := "taggedimage:xfoox", "taggedimage:yzfooyz" + base.Cmd("tag", testutil.CommonImage, taggedOne).Run() + base.Cmd("tag", testutil.CommonImage, taggedTwo).Run() + defer base.Cmd("rmi", taggedOne).AssertOK() + defer base.Cmd("rmi", taggedTwo).AssertOK() // before/since filters are not compatible with DOCKER_BUILDKIT=1? (but still compatible with DOCKER_BUILDKIT=0) if base.Target == testutil.Nerdctl { @@ -119,8 +119,8 @@ LABEL version=0.1`, testutil.CommonImage) base.Cmd("images", "--filter", "label=foo=bar", "--filter", "label=version=0.2").AssertOutNotContains(tempName) base.Cmd("images", "--filter", "label=version").AssertOutContains(tempName) base.Cmd("images", "--filter", fmt.Sprintf("reference=%s*", tempName)).AssertOutContains(tempName) - base.Cmd("images", "--filter", "reference=busy*:*libc*").AssertOutContains("glibc") - base.Cmd("images", "--filter", "reference=busy*:*libc*").AssertOutContains("uclibc") + base.Cmd("images", "--filter", "reference=tag*:*foo*").AssertOutContains("xfoox") + base.Cmd("images", "--filter", "reference=tag*:*foo*").AssertOutContains("yzfooyz") } func TestImagesFilterDangling(t *testing.T) { diff --git a/pkg/testutil/testutil_linux.go b/pkg/testutil/testutil_linux.go index dce9431e021..8c0cca4fdc8 100644 --- a/pkg/testutil/testutil_linux.go +++ b/pkg/testutil/testutil_linux.go @@ -43,6 +43,7 @@ var ( FluentdImage = "fluent/fluentd:v1.17.0-debian-1.0" KuboImage = mirrorOf("ipfs/kubo:v0.16.0") SystemdImage = "ghcr.io/containerd/stargz-snapshotter:0.15.1-kind" + GolangImage = mirrorOf("golang:1.18") // Source: https://gist.github.com/cpuguy83/fcf3041e5d8fb1bb5c340915aabeebe0 NonDistBlobImage = "ghcr.io/cpuguy83/non-dist-blob:latest" diff --git a/pkg/testutil/testutil_windows.go b/pkg/testutil/testutil_windows.go index 54bf1e05b25..edf86ba9143 100644 --- a/pkg/testutil/testutil_windows.go +++ b/pkg/testutil/testutil_windows.go @@ -43,6 +43,8 @@ const ( NginxAlpineImage = "registry.k8s.io/e2e-test-images/nginx:1.14-2" NginxAlpineIndexHTMLSnippet = "