Skip to content

Commit

Permalink
Remove images from Docker Hub from tests, fix #3498
Browse files Browse the repository at this point in the history
Signed-off-by: apostasie <[email protected]>
  • Loading branch information
apostasie committed Oct 7, 2024
1 parent 30db864 commit 3e3517c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
4 changes: 2 additions & 2 deletions cmd/nerdctl/container/container_run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions cmd/nerdctl/image/image_list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions pkg/testutil/testutil_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 2 additions & 0 deletions pkg/testutil/testutil_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ const (
NginxAlpineImage = "registry.k8s.io/e2e-test-images/nginx:1.14-2"
NginxAlpineIndexHTMLSnippet = "<title>Welcome to nginx!</title>"

GolangImage = "fixme-test-using-this-image-is-disabled-on-windows"

// This error string is expected when attempting to connect to a TCP socket
// for a service which actively refuses the connection.
// (e.g. attempting to connect using http to an https endpoint).
Expand Down

0 comments on commit 3e3517c

Please sign in to comment.