Skip to content

Commit

Permalink
tests: Add a reuse flag test for the 'incus image import'
Browse files Browse the repository at this point in the history
Signed-off-by: Piotr Resztak <[email protected]>
  • Loading branch information
presztak committed Nov 27, 2024
1 parent 43b0915 commit b86877a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
16 changes: 16 additions & 0 deletions test/suites/image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,22 @@ 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 ls -f csv | wc -l)" = "1" ]

incus image delete testimage
}

test_image_refresh() {
# shellcheck disable=2039,3043
local INCUS2_DIR INCUS2_ADDR
Expand Down

0 comments on commit b86877a

Please sign in to comment.