From 2553a230d045356b65b6a4ebf824247c4387b4f0 Mon Sep 17 00:00:00 2001 From: Alex Jia Date: Mon, 21 Oct 2019 17:44:49 +0800 Subject: [PATCH] systemtest: inspect container image different from current platform arch When --raw is provided, can inspect show the raw manifest list, w/o requiring any particular platform to be present, this test case is used for make sure inspect command w/ --raw option works well for container image is different from current platform arch. Signed-off-by: Alex Jia --- systemtest/010-inspect.bats | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/systemtest/010-inspect.bats b/systemtest/010-inspect.bats index ee188e13..26d8364d 100644 --- a/systemtest/010-inspect.bats +++ b/systemtest/010-inspect.bats @@ -79,4 +79,38 @@ END_EXPECT done } +@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 + 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 + + for arch in $diff_arch_list; do + remote_image=docker://docker.io/$arch/golang + run_skopeo inspect --tls-verify=false --raw $remote_image + remote=$(echo "$output" | jq -r '.manifests[0]["platform"]') + expect=$(echo "{\"architecture\":\"$arch\",\"os\":\"linux\"}" | jq) + expect_output --from="$remote" --substring "$expect" \ + "platform arch is not expected" + done +} + # vim: filetype=sh