mirror of
https://github.com/containers/skopeo.git
synced 2025-04-27 02:51:02 +00:00
This commit makes skopeo return a different exit code when an input is not found. The use case is `osbuild` which uses skopeo to inspect images and it would be nice to differenciate between an image that is not found and general skopeo errors (or errors like network issues etc). I picked exit code `2` for `not found` because it is also the value of `ENOENT`. Man page and a test are added. Signed-off-by: Michael Vogt <mvogt@redhat.com>
38 lines
821 B
Bash
38 lines
821 B
Bash
#!/usr/bin/env bats
|
|
#
|
|
# Copy tests
|
|
#
|
|
|
|
load helpers
|
|
|
|
function setup() {
|
|
standard_setup
|
|
|
|
start_registry --enable-delete=true reg
|
|
}
|
|
|
|
# delete image from registry
|
|
@test "delete: remove image from registry" {
|
|
local remote_image=docker://quay.io/libpod/busybox:latest
|
|
local localimg=docker://localhost:5000/busybox:unsigned
|
|
local output=
|
|
|
|
run_skopeo copy --dest-tls-verify=false $remote_image $localimg
|
|
output=$(run_skopeo inspect --tls-verify=false --raw $localimg)
|
|
echo $output | grep "vnd.docker.distribution.manifest.v2+json"
|
|
|
|
run_skopeo delete --tls-verify=false $localimg
|
|
|
|
# make sure image is removed from registry
|
|
expected_rc=2
|
|
run_skopeo $expected_rc inspect --tls-verify=false $localimg
|
|
}
|
|
|
|
teardown() {
|
|
podman rm -f reg
|
|
|
|
standard_teardown
|
|
}
|
|
|
|
# vim: filetype=sh
|