Skip to content

Commit 0f8a842

Browse files
committed
tests: image-verify: enable validation of zero-layer images
oci-image-tool would error out if an image manifest had an empty set of layers, but the docker-library meta-scripts support this fine so we can re-enable these validations. This removes the last set of commented-out image-verify checks. Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
1 parent d23463a commit 0f8a842

2 files changed

Lines changed: 9 additions & 14 deletions

File tree

test/create.bats

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -151,14 +151,12 @@ function teardown() {
151151
# Create a new image.
152152
umoci new --image "${IMAGE}:${TAG}"
153153
[ "$status" -eq 0 ]
154-
# XXX: oci-image-tool validate doesn't like empty images (without layers)
155-
#image-verify "$IMAGE"
154+
image-verify "$IMAGE"
156155

157156
# Modify the config.
158157
umoci config --image "${IMAGE}:${TAG}" --config.user "1234:1332"
159158
[ "$status" -eq 0 ]
160-
# XXX: oci-image-tool validate doesn't like empty images (without layers)
161-
#image-verify "$IMAGE"
159+
image-verify "$IMAGE"
162160

163161
# Unpack the image.
164162
new_bundle_rootfs
@@ -191,9 +189,7 @@ function teardown() {
191189
[ "$status" -eq 0 ]
192190
# There should be no non-empty_layers.
193191
[[ "$(echo "$output" | jq -SM '[.history[] | .empty_layer == null] | any')" == "false" ]]
194-
195-
# XXX: oci-image-tool validate doesn't like empty images (without layers)
196-
#image-verify "$IMAGE"
192+
image-verify "$IMAGE"
197193
}
198194

199195
# Given the bad experiences we've had with Go compiler changes resulting in
@@ -225,8 +221,7 @@ function teardown() {
225221
# Create a new image with another tag.
226222
umoci new --image "${IMAGE}:${TAG}"
227223
[ "$status" -eq 0 ]
228-
# XXX: oci-image-tool validate doesn't like empty images (without layers)
229-
#image-verify "$IMAGE"
224+
image-verify "$IMAGE"
230225

231226
# Unpack the image.
232227
new_bundle_rootfs

test/raw-add-layer.bats

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ function teardown() {
5656
# Add layers to the image.
5757
umoci new --image "${IMAGE}:${TAG}"
5858
[ "$status" -eq 0 ]
59-
#image-verify "${IMAGE}"
59+
image-verify "${IMAGE}"
6060
umoci raw add-layer --image "${IMAGE}:${TAG}" "$UMOCI_TMPDIR/layer1.tar"
6161
[ "$status" -eq 0 ]
6262
image-verify "${IMAGE}"
@@ -100,7 +100,7 @@ OCI_MEDIATYPE_LAYER="application/vnd.oci.image.layer.v1.tar"
100100
# Add layer to the image.
101101
umoci new --image "${IMAGE}:${TAG}"
102102
[ "$status" -eq 0 ]
103-
#image-verify "${IMAGE}"
103+
image-verify "${IMAGE}"
104104
umoci raw add-layer --image "${IMAGE}:${TAG}" --compress=gzip "$UMOCI_TMPDIR/layer.tar"
105105
[ "$status" -eq 0 ]
106106
image-verify "${IMAGE}"
@@ -130,7 +130,7 @@ OCI_MEDIATYPE_LAYER="application/vnd.oci.image.layer.v1.tar"
130130
# Add layer to the image.
131131
umoci new --image "${IMAGE}:${TAG}"
132132
[ "$status" -eq 0 ]
133-
#image-verify "${IMAGE}"
133+
image-verify "${IMAGE}"
134134
umoci raw add-layer --image "${IMAGE}:${TAG}" --compress=zstd "$UMOCI_TMPDIR/layer.tar"
135135
[ "$status" -eq 0 ]
136136
image-verify "${IMAGE}"
@@ -160,7 +160,7 @@ OCI_MEDIATYPE_LAYER="application/vnd.oci.image.layer.v1.tar"
160160
# Add layer to the image.
161161
umoci new --image "${IMAGE}:${TAG}"
162162
[ "$status" -eq 0 ]
163-
#image-verify "${IMAGE}"
163+
image-verify "${IMAGE}"
164164
umoci raw add-layer --image "${IMAGE}:${TAG}" --compress=none "$UMOCI_TMPDIR/layer.tar"
165165
[ "$status" -eq 0 ]
166166
image-verify "${IMAGE}"
@@ -190,7 +190,7 @@ OCI_MEDIATYPE_LAYER="application/vnd.oci.image.layer.v1.tar"
190190
# Add zstd layer to the image.
191191
umoci new --image "${IMAGE}:${TAG}"
192192
[ "$status" -eq 0 ]
193-
#image-verify "${IMAGE}"
193+
image-verify "${IMAGE}"
194194
umoci raw add-layer --image "${IMAGE}:${TAG}" --compress=zstd "$UMOCI_TMPDIR/layer.tar"
195195
[ "$status" -eq 0 ]
196196
image-verify "${IMAGE}"

0 commit comments

Comments
 (0)