diff --git a/systemtest/010-inspect.bats b/systemtest/010-inspect.bats index b465d086..f06d83b8 100644 --- a/systemtest/010-inspect.bats +++ b/systemtest/010-inspect.bats @@ -65,59 +65,47 @@ END_EXPECT } @test "inspect: env" { - remote_image=docker://docker.io/fedora:latest + remote_image=docker://quay.io/libpod/fedora:31 run_skopeo inspect $remote_image inspect_remote=$output # Simple check on 'inspect' output with environment variables. # 1) Get remote image values of environment variables (the value of 'Env') # 2) Confirm substring in check_array and the value of 'Env' match. - check_array=(PATH=.* ) + check_array=(FGC=f31 DISTTAG=f31container) remote=$(jq '.Env[]' <<<"$inspect_remote") for substr in ${check_array[@]}; do expect_output --from="$remote" --substring "$substr" done } +# Tests https://github.com/containers/skopeo/pull/708 @test "inspect: image manifest list w/ diff platform" { - # When --raw is provided, can inspect show the raw manifest list, w/o - # requiring any particular platform to be present - # To test whether container image can be inspected successfully w/o - # platform dependency. - # 1) Get current platform arch - # 2) Inspect container image is different from current platform arch - # 3) Compare output w/ expected result + # This image's manifest is for an os + arch that is... um, unlikely + # to support skopeo in the foreseeable future. Or past. The image + # is created by the make-noarch-manifest script in this directory. + img=docker://quay.io/libpod/notmyarch:20210121 - # Here we see a revolting workaround for a podman incompatibility - # change: in April 2020, podman info completely changed format - # of the keys. What worked until then now throws an error. We - # need to work with both old and new podman. - arch=$(podman info --format '{{.host.arch}}' || true) - if [[ -z "$arch" ]]; then - arch=$(podman info --format '{{.Host.Arch}}') - fi + # Get our host arch (what we're running on). This assumes that skopeo + # arch matches podman; it also assumes running podman >= April 2020 + # (prior to that, the format keys were lower-case). + arch=$(podman info --format '{{.Host.Arch}}') - case $arch in - "amd64") - diff_arch_list="s390x ppc64le" - ;; - "s390x") - diff_arch_list="amd64 ppc64le" - ;; - "ppc64le") - diff_arch_list="amd64 s390x" - ;; - "*") - diff_arch_list="amd64 s390x ppc64le" - ;; - esac + # By default, 'inspect' tries to match our host os+arch. This should fail. + run_skopeo 1 inspect $img + expect_output --substring "Error parsing manifest for image: Error choosing image instance: no image found in manifest list for architecture $arch, variant " \ + "skopeo inspect, without --raw, fails" - for arch in $diff_arch_list; do - remote_image=docker://docker.io/$arch/golang - run_skopeo inspect --tls-verify=false --raw $remote_image - remote_arch=$(jq -r '.manifests[0]["platform"]["architecture"]' <<< "$output") - expect_output --from="$remote_arch" "$arch" "platform arch of $remote_image" - done + # With --raw, we can inspect + run_skopeo inspect --raw $img + expect_output --substring "manifests.*platform.*architecture" \ + "skopeo inspect --raw returns reasonable output" + + # ...and what we get should be consistent with what our script created. + archinfo=$(jq -r '.manifests[0].platform | {os,variant,architecture} | join("-")' <<<"$output") + + expect_output --from="$archinfo" "amigaos-1000-mc68000" \ + "os - variant - architecture of $img" } # vim: filetype=sh diff --git a/systemtest/020-copy.bats b/systemtest/020-copy.bats index a723958c..f7cf99e0 100644 --- a/systemtest/020-copy.bats +++ b/systemtest/020-copy.bats @@ -14,7 +14,7 @@ function setup() { # From remote, to dir1, to local, to dir2; # compare dir1 and dir2, expect no changes @test "copy: dir, round trip" { - local remote_image=docker://docker.io/library/busybox:latest + local remote_image=docker://quay.io/libpod/busybox:latest local localimg=docker://localhost:5000/busybox:unsigned local dir1=$TESTDIR/dir1 @@ -30,7 +30,7 @@ function setup() { # Same as above, but using 'oci:' instead of 'dir:' and with a :latest tag @test "copy: oci, round trip" { - local remote_image=docker://docker.io/library/busybox:latest + local remote_image=docker://quay.io/libpod/busybox:latest local localimg=docker://localhost:5000/busybox:unsigned local dir1=$TESTDIR/oci1 @@ -46,7 +46,7 @@ function setup() { # Compression zstd @test "copy: oci, round trip, zstd" { - local remote_image=docker://docker.io/library/busybox:latest + local remote_image=docker://quay.io/libpod/busybox:latest local dir=$TESTDIR/dir @@ -61,7 +61,7 @@ function setup() { # Same image, extracted once with :tag and once without @test "copy: oci w/ and w/o tags" { - local remote_image=docker://docker.io/library/busybox:latest + local remote_image=docker://quay.io/libpod/busybox:latest local dir1=$TESTDIR/dir1 local dir2=$TESTDIR/dir2 @@ -78,7 +78,7 @@ function setup() { # Registry -> storage -> oci-archive @test "copy: registry -> storage -> oci-archive" { - local alpine=docker.io/library/alpine:latest + local alpine=quay.io/libpod/alpine:latest local tmp=$TESTDIR/oci run_skopeo copy docker://$alpine containers-storage:$alpine diff --git a/systemtest/030-local-registry-tls.bats b/systemtest/030-local-registry-tls.bats index f04f29e5..072b4851 100644 --- a/systemtest/030-local-registry-tls.bats +++ b/systemtest/030-local-registry-tls.bats @@ -14,7 +14,7 @@ function setup() { @test "local registry, with cert" { # Push to local registry... run_skopeo copy --dest-cert-dir=$TESTDIR/client-auth \ - docker://docker.io/library/busybox:latest \ + docker://quay.io/libpod/busybox:latest \ docker://localhost:5000/busybox:unsigned # ...and pull it back out diff --git a/systemtest/040-local-registry-auth.bats b/systemtest/040-local-registry-auth.bats index a2b34c2f..d6be6b97 100644 --- a/systemtest/040-local-registry-auth.bats +++ b/systemtest/040-local-registry-auth.bats @@ -43,7 +43,7 @@ function setup() { # These should pass run_skopeo copy --dest-tls-verify=false --dcreds=$testuser:$testpassword \ - docker://docker.io/library/busybox:latest \ + docker://quay.io/libpod/busybox:latest \ docker://localhost:5000/busybox:mine run_skopeo inspect --tls-verify=false --creds=$testuser:$testpassword \ docker://localhost:5000/busybox:mine @@ -55,7 +55,7 @@ function setup() { podman login --tls-verify=false -u $testuser -p $testpassword localhost:5000 run_skopeo copy --dest-tls-verify=false \ - docker://docker.io/library/busybox:latest \ + docker://quay.io/libpod/busybox:latest \ docker://localhost:5000/busybox:mine run_skopeo inspect --tls-verify=false docker://localhost:5000/busybox:mine expect_output --substring "localhost:5000/busybox" diff --git a/systemtest/050-signing.bats b/systemtest/050-signing.bats index 4f521415..57bf110d 100644 --- a/systemtest/050-signing.bats +++ b/systemtest/050-signing.bats @@ -92,7 +92,7 @@ END_POLICY_JSON fi # Cache local copy - run_skopeo copy docker://docker.io/library/busybox:latest \ + run_skopeo copy docker://quay.io/libpod/busybox:latest \ dir:$TESTDIR/busybox # Push a bunch of images. Do so *without* --policy flag; this lets us diff --git a/systemtest/060-delete.bats b/systemtest/060-delete.bats index 145ed377..09e6688a 100644 --- a/systemtest/060-delete.bats +++ b/systemtest/060-delete.bats @@ -13,7 +13,7 @@ function setup() { # delete image from registry @test "delete: remove image from registry" { - local remote_image=docker://docker.io/library/busybox:latest + local remote_image=docker://quay.io/libpod/busybox:latest local localimg=docker://localhost:5000/busybox:unsigned local output= diff --git a/systemtest/helpers.bash b/systemtest/helpers.bash index 8211b18a..8a3710ad 100644 --- a/systemtest/helpers.bash +++ b/systemtest/helpers.bash @@ -6,7 +6,7 @@ SKOPEO_BINARY=${SKOPEO_BINARY:-$(dirname ${BASH_SOURCE})/../skopeo} SKOPEO_TIMEOUT=${SKOPEO_TIMEOUT:-300} # Default image to run as a local registry -REGISTRY_FQIN=${SKOPEO_TEST_REGISTRY_FQIN:-docker.io/library/registry:2} +REGISTRY_FQIN=${SKOPEO_TEST_REGISTRY_FQIN:-quay.io/libpod/registry:2} ############################################################################### # BEGIN setup/teardown diff --git a/systemtest/make-noarch-manifest b/systemtest/make-noarch-manifest new file mode 100755 index 00000000..8fb9caa1 --- /dev/null +++ b/systemtest/make-noarch-manifest @@ -0,0 +1,70 @@ +#!/bin/sh +# +# Tool for creating an image whose OS and arch will (probably) never +# match a system on which skopeo will run. This image will be used +# in the 'inspect' test. +# +set -ex + +# Name and tag of the image we create +imgname=notmyarch +imgtag=$(date +%Y%m%d) + +# (In case older image exists from a prior run) +buildah rmi $imgname:$imgtag &>/dev/null || true + +# +# Step 1: create an image containing only a README and a copy of this script +# +id=$(buildah from scratch) + +now=$(date --rfc-3339=seconds) +readme=$(mktemp -t README.XXXXXXXX) +ME=$(basename $0) + +cat >| $readme <