test/system: Add a helper to pull the default image and copy it

This will be used in subsequent commits to test the handling of such
copied images in 'toolbox list' and 'toolbox rmi'.

https://github.com/containers/toolbox/issues/1043
This commit is contained in:
Martin Krajnak 2022-12-09 13:03:52 +01:00 committed by Debarshi Ray
parent a0d4c957b3
commit d5daa7167e

View file

@ -327,6 +327,29 @@ function pull_default_image() {
} }
function pull_default_image_and_copy() {
pull_default_image
local distro
local version
local image
distro="$(get_system_id)"
version="$(get_system_version)"
image="${IMAGES[$distro]}:$version"
# https://github.com/containers/skopeo/issues/547 for the options for containers-storage
run "$SKOPEO" copy \
"containers-storage:[overlay@$ROOTLESS_PODMAN_STORE_DIR+$ROOTLESS_PODMAN_STORE_DIR]$image" \
"containers-storage:[overlay@$ROOTLESS_PODMAN_STORE_DIR+$ROOTLESS_PODMAN_STORE_DIR]$image-copy"
if [ "$status" -ne 0 ]; then
echo "Failed to copy image $image to $image-copy"
assert_success
fi
}
# Creates a container with specific name, distro and version # Creates a container with specific name, distro and version
# #
# Pulling of an image is taken care of by the function # Pulling of an image is taken care of by the function