summaryrefslogtreecommitdiff
path: root/libpod/image/image_test.go
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2021-03-24 13:10:51 +0100
committerValentin Rothberg <rothberg@redhat.com>2021-03-25 16:20:35 +0100
commit2a66ef333affa84932ae7b9d3377b622d9f75e55 (patch)
tree04e6dde22cd2ad3868774ee669cd17cfc3100c6c /libpod/image/image_test.go
parent7fe40cd20357f04076826c64c1860a17661f0a57 (diff)
downloadpodman-2a66ef333affa84932ae7b9d3377b622d9f75e55.tar.gz
podman-2a66ef333affa84932ae7b9d3377b622d9f75e55.tar.bz2
podman-2a66ef333affa84932ae7b9d3377b622d9f75e55.zip
libpod/image: unit tests: use a `registries.conf` for aliases
Since some unit tests use "busybox", we need to point it to some alias if we want it to pass CI on F34 where we're running in enforced mode. Furthermore, make sure that the registries.conf can actually be overridden in the code. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'libpod/image/image_test.go')
-rw-r--r--libpod/image/image_test.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/libpod/image/image_test.go b/libpod/image/image_test.go
index ff73ab929..d95a22f76 100644
--- a/libpod/image/image_test.go
+++ b/libpod/image/image_test.go
@@ -138,11 +138,14 @@ func TestImage_New(t *testing.T) {
names = append(names, bbNames...)
writer := os.Stdout
+ opts := DockerRegistryOptions{
+ RegistriesConfPath: "testdata/registries.conf",
+ }
// Iterate over the names and delete the image
// after the pull
for _, img := range names {
- newImage, err := ir.New(context.Background(), img, "", "", writer, nil, SigningOptions{}, nil, util.PullImageMissing, nil)
- require.NoError(t, err)
+ newImage, err := ir.New(context.Background(), img, "", "", writer, &opts, SigningOptions{}, nil, util.PullImageMissing, nil)
+ require.NoError(t, err, img)
assert.NotEqual(t, newImage.ID(), "")
err = newImage.Remove(context.Background(), false)
assert.NoError(t, err)
@@ -167,8 +170,11 @@ func TestImage_MatchRepoTag(t *testing.T) {
require.NoError(t, err)
defer cleanup(workdir, ir)
+ opts := DockerRegistryOptions{
+ RegistriesConfPath: "testdata/registries.conf",
+ }
ir.Eventer = events.NewNullEventer()
- newImage, err := ir.New(context.Background(), "busybox", "", "", os.Stdout, nil, SigningOptions{}, nil, util.PullImageMissing, nil)
+ newImage, err := ir.New(context.Background(), "busybox", "", "", os.Stdout, &opts, SigningOptions{}, nil, util.PullImageMissing, nil)
require.NoError(t, err)
err = newImage.TagImage("foo:latest")
require.NoError(t, err)