Skip to content

Commit d23463a

Browse files
committed
tests: image-verify: enable zstd image validation
oci-image-tool did not support validating such images, but now that we have disabled it we should at least include the checks that the compression type is correct (and when we add "umoci validate" we won't forget to enable these tests). Fixes: f8f12bc ("cmd: add --compress= option to repack-like commands") Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
1 parent f290ca5 commit d23463a

4 files changed

Lines changed: 18 additions & 18 deletions

File tree

test/insert.bats

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ OCI_MEDIATYPE_LAYER="application/vnd.oci.image.layer.v1.tar"
420420
# Add layer to the image.
421421
umoci insert --image "${IMAGE}:${TAG}" --compress=zstd "${INSERTDIR}/etc" /etc
422422
[ "$status" -eq 0 ]
423-
#image-verify "${IMAGE}" # image-tools cannot handle zstd
423+
image-verify "${IMAGE}"
424424

425425
umoci stat --image "${IMAGE}:${TAG}" --json
426426
[ "$status" -eq 0 ]
@@ -476,7 +476,7 @@ OCI_MEDIATYPE_LAYER="application/vnd.oci.image.layer.v1.tar"
476476
# Add zstd layer to the image.
477477
umoci insert --image "${IMAGE}:${TAG}" --compress=zstd "${INSERTDIR}/etc" /etc
478478
[ "$status" -eq 0 ]
479-
#image-verify "${IMAGE}" # image-tools cannot handle zstd
479+
image-verify "${IMAGE}"
480480

481481
umoci stat --image "${IMAGE}:${TAG}" --json
482482
[ "$status" -eq 0 ]
@@ -497,7 +497,7 @@ OCI_MEDIATYPE_LAYER="application/vnd.oci.image.layer.v1.tar"
497497
# Add another zstd layer to the image, by making use of the auto selection.
498498
umoci insert --image "${IMAGE}:${TAG}" --compress=auto "${INSERTDIR}/etc" /etc
499499
[ "$status" -eq 0 ]
500-
#image-verify "${IMAGE}" # image-tools cannot handle zstd
500+
image-verify "${IMAGE}"
501501

502502
umoci stat --image "${IMAGE}:${TAG}" --json
503503
[ "$status" -eq 0 ]
@@ -519,7 +519,7 @@ OCI_MEDIATYPE_LAYER="application/vnd.oci.image.layer.v1.tar"
519519
# the default.
520520
umoci insert --image "${IMAGE}:${TAG}" "${INSERTDIR}/etc" /etc
521521
[ "$status" -eq 0 ]
522-
#image-verify "${IMAGE}" # image-tools cannot handle zstd
522+
image-verify "${IMAGE}"
523523

524524
umoci stat --image "${IMAGE}:${TAG}" --json
525525
[ "$status" -eq 0 ]

test/raw-add-layer.bats

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ OCI_MEDIATYPE_LAYER="application/vnd.oci.image.layer.v1.tar"
133133
#image-verify "${IMAGE}"
134134
umoci raw add-layer --image "${IMAGE}:${TAG}" --compress=zstd "$UMOCI_TMPDIR/layer.tar"
135135
[ "$status" -eq 0 ]
136-
#image-verify "${IMAGE}" # image-tools cannot handle zstd
136+
image-verify "${IMAGE}"
137137

138138
umoci stat --image "${IMAGE}:${TAG}" --json
139139
[ "$status" -eq 0 ]
@@ -193,7 +193,7 @@ OCI_MEDIATYPE_LAYER="application/vnd.oci.image.layer.v1.tar"
193193
#image-verify "${IMAGE}"
194194
umoci raw add-layer --image "${IMAGE}:${TAG}" --compress=zstd "$UMOCI_TMPDIR/layer.tar"
195195
[ "$status" -eq 0 ]
196-
#image-verify "${IMAGE}" # image-tools cannot handle zstd
196+
image-verify "${IMAGE}"
197197

198198
umoci stat --image "${IMAGE}:${TAG}" --json
199199
[ "$status" -eq 0 ]
@@ -214,7 +214,7 @@ OCI_MEDIATYPE_LAYER="application/vnd.oci.image.layer.v1.tar"
214214
# Add another zstd layer to the image, by making use of the auto selection.
215215
umoci raw add-layer --image "${IMAGE}:${TAG}" --compress=auto "$UMOCI_TMPDIR/layer.tar"
216216
[ "$status" -eq 0 ]
217-
#image-verify "${IMAGE}" # image-tools cannot handle zstd
217+
image-verify "${IMAGE}"
218218

219219
umoci stat --image "${IMAGE}:${TAG}" --json
220220
[ "$status" -eq 0 ]
@@ -236,7 +236,7 @@ OCI_MEDIATYPE_LAYER="application/vnd.oci.image.layer.v1.tar"
236236
# the default.
237237
umoci raw add-layer --image "${IMAGE}:${TAG}" "$UMOCI_TMPDIR/layer.tar"
238238
[ "$status" -eq 0 ]
239-
#image-verify "${IMAGE}" # image-tools cannot handle zstd
239+
image-verify "${IMAGE}"
240240

241241
umoci stat --image "${IMAGE}:${TAG}" --json
242242
[ "$status" -eq 0 ]

test/repack.bats

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,7 @@ OCI_MEDIATYPE_LAYER="application/vnd.oci.image.layer.v1.tar"
928928
# Add layer to the image.
929929
umoci repack --image "${IMAGE}:${TAG}" --compress=zstd "$BUNDLE"
930930
[ "$status" -eq 0 ]
931-
#image-verify "${IMAGE}" # image-tools cannot handle zstd
931+
image-verify "${IMAGE}"
932932

933933
umoci stat --image "${IMAGE}:${TAG}" --json
934934
[ "$status" -eq 0 ]
@@ -990,7 +990,7 @@ OCI_MEDIATYPE_LAYER="application/vnd.oci.image.layer.v1.tar"
990990
# Add zstd layer to the image.
991991
umoci repack --image "${IMAGE}:${TAG}" --refresh-bundle --compress=zstd "$BUNDLE"
992992
[ "$status" -eq 0 ]
993-
#image-verify "${IMAGE}" # image-tools cannot handle zstd
993+
image-verify "${IMAGE}"
994994

995995
umoci stat --image "${IMAGE}:${TAG}" --json
996996
[ "$status" -eq 0 ]
@@ -1013,7 +1013,7 @@ OCI_MEDIATYPE_LAYER="application/vnd.oci.image.layer.v1.tar"
10131013
# Add another zstd layer to the image, by making use of the auto selection.
10141014
umoci repack --image "${IMAGE}:${TAG}" --refresh-bundle --compress=auto "$BUNDLE"
10151015
[ "$status" -eq 0 ]
1016-
#image-verify "${IMAGE}" # image-tools cannot handle zstd
1016+
image-verify "${IMAGE}"
10171017

10181018
umoci stat --image "${IMAGE}:${TAG}" --json
10191019
[ "$status" -eq 0 ]
@@ -1037,7 +1037,7 @@ OCI_MEDIATYPE_LAYER="application/vnd.oci.image.layer.v1.tar"
10371037
# the default.
10381038
umoci repack --image "${IMAGE}:${TAG}" --refresh-bundle "$BUNDLE"
10391039
[ "$status" -eq 0 ]
1040-
#image-verify "${IMAGE}" # image-tools cannot handle zstd
1040+
image-verify "${IMAGE}"
10411041

10421042
umoci stat --image "${IMAGE}:${TAG}" --json
10431043
[ "$status" -eq 0 ]

test/unpack.bats

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -369,37 +369,37 @@ function teardown() {
369369
touch "$ROOTFS/zstd1"
370370
umoci repack --image "${IMAGE}:${TAG}" --refresh-bundle --compress=zstd "$BUNDLE"
371371
[ "$status" -eq 0 ]
372-
#image-verify "${IMAGE}" # image-tools cannot handle zstd
372+
image-verify "${IMAGE}"
373373

374374
# gzip layer
375375
touch "$ROOTFS/gzip1"
376376
umoci repack --image "${IMAGE}:${TAG}" --refresh-bundle --compress=gzip "$BUNDLE"
377377
[ "$status" -eq 0 ]
378-
#image-verify "${IMAGE}" # image-tools cannot handle zstd
378+
image-verify "${IMAGE}"
379379

380380
# plain layer
381381
touch "$ROOTFS/plain1"
382382
umoci repack --image "${IMAGE}:${TAG}" --refresh-bundle --compress=none "$BUNDLE"
383383
[ "$status" -eq 0 ]
384-
#image-verify "${IMAGE}" # image-tools cannot handle zstd
384+
image-verify "${IMAGE}"
385385

386386
# zstd layer
387387
touch "$ROOTFS/zstd2"
388388
umoci repack --image "${IMAGE}:${TAG}" --refresh-bundle --compress=zstd "$BUNDLE"
389389
[ "$status" -eq 0 ]
390-
#image-verify "${IMAGE}" # image-tools cannot handle zstd
390+
image-verify "${IMAGE}"
391391

392392
# plain layer
393393
touch "$ROOTFS/plain2"
394394
umoci repack --image "${IMAGE}:${TAG}" --refresh-bundle --compress=none "$BUNDLE"
395395
[ "$status" -eq 0 ]
396-
#image-verify "${IMAGE}" # image-tools cannot handle zstd
396+
image-verify "${IMAGE}"
397397

398398
# zstd layer (auto)
399399
touch "$ROOTFS/zstd3"
400400
umoci repack --image "${IMAGE}:${TAG}" --refresh-bundle "$BUNDLE"
401401
[ "$status" -eq 0 ]
402-
#image-verify "${IMAGE}" # image-tools cannot handle zstd
402+
image-verify "${IMAGE}"
403403

404404
# Re-extract the latest image and make sure all of the files were correctly
405405
# extracted.

0 commit comments

Comments
 (0)