Skip to content

Commit c846f02

Browse files
committed
libimage tests: try to avoid docker.io images
These images can and will change at any time and thus can break our CI without any external changes which is very bad. The TestPush test is failing because it expects two not one image as it converts from docker to oci on push. However the upstream docker.io/library/alpine was switched to an oci image thus the test started failing as the local storage now has the same id and just stores two different tags for the same image. Switch to our own controlled quay.io images where possible. This is neither complete nor do I fully understand the tests here. I did a quick search and replace and will see what works or not. Signed-off-by: Paul Holzinger <[email protected]> (cherry picked from commit 97d2614)
1 parent 8d156f7 commit c846f02

File tree

6 files changed

+20
-20
lines changed

6 files changed

+20
-20
lines changed

Diff for: libimage/image_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ func TestUntag(t *testing.T) {
391391
func getImageAndRuntime(t *testing.T) (*Runtime, *Image) {
392392
// Note: this will resolve pull from the GCR registry (see
393393
// testdata/registries.conf).
394-
busyboxLatest := "docker.io/library/busybox:latest"
394+
busyboxLatest := "quay.io/libpod/busybox:latest"
395395

396396
runtime := testNewRuntime(t)
397397
ctx := context.Background()

Diff for: libimage/pull_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ func TestPullOCINoReference(t *testing.T) {
223223
// Exercise pulling from the OCI transport and make sure that a
224224
// specified reference is preserved in the image name.
225225

226-
busybox := "docker.io/library/busybox:latest"
226+
busybox := "quay.io/libpod/busybox:latest"
227227
runtime := testNewRuntime(t)
228228
ctx := context.Background()
229229
pullOptions := &PullOptions{}

Diff for: libimage/push_test.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func TestPush(t *testing.T) {
2222
// Prefetch alpine.
2323
pullOptions := &PullOptions{}
2424
pullOptions.Writer = os.Stdout
25-
_, err := runtime.Pull(ctx, "docker.io/library/alpine:latest", config.PullPolicyAlways, pullOptions)
25+
_, err := runtime.Pull(ctx, "quay.io/libpod/alpine:latest", config.PullPolicyAlways, pullOptions)
2626
require.NoError(t, err)
2727

2828
pushOptions := &PushOptions{}
@@ -81,7 +81,7 @@ func TestPushOtherPlatform(t *testing.T) {
8181
pullOptions := &PullOptions{}
8282
pullOptions.Writer = os.Stdout
8383
pullOptions.Architecture = "arm64"
84-
pulledImages, err := runtime.Pull(ctx, "docker.io/library/alpine:latest", config.PullPolicyAlways, pullOptions)
84+
pulledImages, err := runtime.Pull(ctx, "quay.io/libpod/alpine:latest", config.PullPolicyAlways, pullOptions)
8585
require.NoError(t, err)
8686
require.Len(t, pulledImages, 1)
8787

@@ -95,7 +95,7 @@ func TestPushOtherPlatform(t *testing.T) {
9595
require.NoError(t, err)
9696
tmp.Close()
9797
defer os.Remove(tmp.Name())
98-
_, err = runtime.Push(ctx, "docker.io/library/alpine:latest", "docker-archive:"+tmp.Name(), pushOptions)
98+
_, err = runtime.Push(ctx, "quay.io/libpod/alpine:latest", "docker-archive:"+tmp.Name(), pushOptions)
9999
require.NoError(t, err)
100100
}
101101

@@ -107,7 +107,7 @@ func TestPushWithForceCompression(t *testing.T) {
107107
pullOptions := &PullOptions{}
108108
pullOptions.Writer = os.Stdout
109109
pullOptions.Architecture = "arm64"
110-
pulledImages, err := runtime.Pull(ctx, "docker.io/library/alpine:latest", config.PullPolicyAlways, pullOptions)
110+
pulledImages, err := runtime.Pull(ctx, "quay.io/libpod/alpine:latest", config.PullPolicyAlways, pullOptions)
111111
require.NoError(t, err)
112112
require.Len(t, pulledImages, 1)
113113

@@ -121,7 +121,7 @@ func TestPushWithForceCompression(t *testing.T) {
121121
pushOptions.SystemContext.DirForceDecompress = true
122122
pushOptions.Writer = os.Stdout
123123
dirDest := t.TempDir()
124-
_, err = runtime.Push(ctx, "docker.io/library/alpine:latest", "dir:"+dirDest, pushOptions)
124+
_, err = runtime.Push(ctx, "quay.io/libpod/alpine:latest", "dir:"+dirDest, pushOptions)
125125
require.NoError(t, err)
126126

127127
// Pull uncompressed alpine from `dir:dirDest` as source.
@@ -137,7 +137,7 @@ func TestPushWithForceCompression(t *testing.T) {
137137
pushOptions.OciAcceptUncompressedLayers = true
138138
pushOptions.Writer = os.Stdout
139139
ociDest := t.TempDir()
140-
_, err = runtime.Push(ctx, "docker.io/library/alpine:latest", "oci:"+ociDest, pushOptions)
140+
_, err = runtime.Push(ctx, "quay.io/libpod/alpine:latest", "oci:"+ociDest, pushOptions)
141141
require.NoError(t, err)
142142

143143
// blobs from first push
@@ -154,7 +154,7 @@ func TestPushWithForceCompression(t *testing.T) {
154154
pushOptions.Writer = os.Stdout
155155
pushOptions.CompressionFormat = &compression.Gzip
156156
pushOptions.ForceCompressionFormat = false
157-
_, err = runtime.Push(ctx, "docker.io/library/alpine:latest", "oci:"+ociDest, pushOptions)
157+
_, err = runtime.Push(ctx, "quay.io/libpod/alpine:latest", "oci:"+ociDest, pushOptions)
158158
require.NoError(t, err)
159159

160160
// blobs from second push
@@ -175,7 +175,7 @@ func TestPushWithForceCompression(t *testing.T) {
175175
pushOptions.Writer = os.Stdout
176176
pushOptions.CompressionFormat = &compression.Gzip
177177
pushOptions.ForceCompressionFormat = true
178-
_, err = runtime.Push(ctx, "docker.io/library/alpine:latest", "oci:"+ociDest, pushOptions)
178+
_, err = runtime.Push(ctx, "quay.io/libpod/alpine:latest", "oci:"+ociDest, pushOptions)
179179
require.NoError(t, err)
180180

181181
// collect blobs from third push

Diff for: libimage/remove_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
func TestRemoveImages(t *testing.T) {
1515
// Note: this will resolve pull from the GCR registry (see
1616
// testdata/registries.conf).
17-
busyboxLatest := "docker.io/library/busybox:latest"
17+
busyboxLatest := "quay.io/libpod/busybox:latest"
1818

1919
runtime := testNewRuntime(t)
2020
ctx := context.Background()

Diff for: libimage/runtime_test.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ func TestRuntimeListImagesAllImages(t *testing.T) {
109109
ctx := context.Background()
110110

111111
// Prefetch alpine, busybox.
112-
testRuntimePullImage(t, runtime, ctx, "docker.io/library/alpine:latest")
113-
testRuntimePullImage(t, runtime, ctx, "docker.io/library/busybox:latest")
112+
testRuntimePullImage(t, runtime, ctx, "quay.io/libpod/alpine:latest")
113+
testRuntimePullImage(t, runtime, ctx, "quay.io/libpod/busybox:latest")
114114

115115
images, err := runtime.ListImages(ctx, nil)
116116
require.NoError(t, err)
@@ -122,7 +122,7 @@ func TestRuntimeListImagesAllImages(t *testing.T) {
122122
}
123123
assert.ElementsMatch(t,
124124
image_names,
125-
[]string{"docker.io/library/alpine:latest", "docker.io/library/busybox:latest"},
125+
[]string{"quay.io/libpod/alpine:latest", "quay.io/libpod/busybox:latest"},
126126
)
127127
}
128128

@@ -131,15 +131,15 @@ func TestRuntimeListImagesByNames(t *testing.T) {
131131
ctx := context.Background()
132132

133133
// Prefetch alpine, busybox.
134-
testRuntimePullImage(t, runtime, ctx, "docker.io/library/alpine:latest")
135-
testRuntimePullImage(t, runtime, ctx, "docker.io/library/busybox:latest")
134+
testRuntimePullImage(t, runtime, ctx, "quay.io/libpod/alpine:latest")
135+
testRuntimePullImage(t, runtime, ctx, "quay.io/libpod/busybox:latest")
136136

137137
for _, test := range []struct {
138138
name string
139139
fullName string
140140
}{
141-
{"alpine", "docker.io/library/alpine:latest"},
142-
{"busybox", "docker.io/library/busybox:latest"},
141+
{"alpine", "quay.io/libpod/alpine:latest"},
142+
{"busybox", "quay.io/libpod/busybox:latest"},
143143
} {
144144
images, err := runtime.ListImagesByNames([]string{test.name})
145145
require.NoError(t, err)

Diff for: libimage/save_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ func TestSave(t *testing.T) {
1919
// Prefetch alpine, busybox.
2020
pullOptions := &PullOptions{}
2121
pullOptions.Writer = os.Stdout
22-
_, err := runtime.Pull(ctx, "docker.io/library/alpine:latest", config.PullPolicyAlways, pullOptions)
22+
_, err := runtime.Pull(ctx, "quay.io/libpod/alpine:latest", config.PullPolicyAlways, pullOptions)
2323
require.NoError(t, err)
24-
_, err = runtime.Pull(ctx, "docker.io/library/busybox:latest", config.PullPolicyAlways, pullOptions)
24+
_, err = runtime.Pull(ctx, "quay.io/libpod/busybox:latest", config.PullPolicyAlways, pullOptions)
2525
require.NoError(t, err)
2626

2727
// Save the two images into a multi-image archive. This way, we can

0 commit comments

Comments
 (0)