020-copy.bats: check that we set the manifest type correctly

When copying to an OCI layout destination, forcing zstd compression,
check that the manifest correctly describes the type of the layer blob.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
This commit is contained in:
Nalin Dahyabhai 2020-12-03 16:57:12 -05:00
parent 5995ceedf9
commit 81e66ffc46

View File

@ -45,7 +45,7 @@ function setup() {
}
# Compression zstd
@test "copy: oci, round trip, zstd" {
@test "copy: oci, zstd" {
local remote_image=docker://quay.io/libpod/busybox:latest
local dir=$TESTDIR/dir
@ -57,6 +57,12 @@ function setup() {
# Check there is at least one file that has the zstd magic number as the first 4 bytes
(for i in $dir/blobs/sha256/*; do test "$(head -c 4 $i)" = $magic && exit 0; done; exit 1)
# Check that the manifest's description of the image's first layer is the zstd layer type
instance=$(jq -r '.manifests[0].digest' $dir/index.json)
[[ "$instance" != null ]]
mediatype=$(jq -r '.layers[0].mediaType' < $dir/blobs/${instance/://})
[[ "$mediatype" == "application/vnd.oci.image.layer.v1.tar+zstd" ]]
}
# Same image, extracted once with :tag and once without