From a9344b9997f3969714a37856107cf0eaf0da44f9 Mon Sep 17 00:00:00 2001 From: Piotr Resztak Date: Wed, 27 Nov 2024 23:19:45 +0100 Subject: [PATCH] tests: Add a reuse flag test for the 'incus image import' Signed-off-by: Piotr Resztak --- test/main.sh | 1 + test/suites/image.sh | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/test/main.sh b/test/main.sh index 37e88a823b7..decad43790b 100755 --- a/test/main.sh +++ b/test/main.sh @@ -296,6 +296,7 @@ if [ "${1:-"all"}" != "cluster" ]; then run_test test_image_auto_update "image auto-update" run_test test_image_prefer_cached "image prefer cached" run_test test_image_import_dir "import image from directory" + run_test test_image_import_with_reuse "import image with reuse flag" run_test test_image_refresh "image refresh" run_test test_image_acl "image acl" run_test test_cloud_init "cloud-init" diff --git a/test/suites/image.sh b/test/suites/image.sh index 02c8ac2811b..36682b7dad6 100644 --- a/test/suites/image.sh +++ b/test/suites/image.sh @@ -122,6 +122,21 @@ test_image_import_existing_alias() { incus image delete newimage image2 } +test_image_import_with_reuse() { + ensure_import_testimage + incus init testimage c + fingerprint="$(incus publish c --alias image1 | awk '{print $NF;}')" + incus delete c + incus image export image1 image1.file + incus image delete image1 + + incus image import image1.file.tar.gz --alias testimage --reuse + + [ "$(incus image ls -c F -f csv testimage)" = "${fingerprint}" ] + + incus image delete testimage +} + test_image_refresh() { # shellcheck disable=2039,3043 local INCUS2_DIR INCUS2_ADDR