Skip to content

Commit

Permalink
Test image list of some builtin remotes (#14564)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomponline authored Dec 1, 2024
2 parents 8c4e491 + 76d3088 commit cf64979
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
1 change: 1 addition & 0 deletions test/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ if [ "${1:-"all"}" != "cluster" ]; then
run_test test_security_protection "container protection"
run_test test_image_expiry "image expiry"
run_test test_image_list_all_aliases "image list all aliases"
run_test test_image_list_remotes "image list of simplestream remotes"
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"
Expand Down
19 changes: 16 additions & 3 deletions test/suites/image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,24 @@ test_image_list_all_aliases() {
local sum
sum="$(lxc image info testimage | awk '/^Fingerprint/ {print $2}')"
lxc image alias create zzz "$sum"
lxc image list | grep -vq zzz
# both aliases are listed if the "aliases" column is included in output
lxc image list -c L | grep -q testimage
lxc image list -c L | grep -q zzz
lxc image list -c L | grep -qwF testimage
lxc image list -c L | grep -qwF zzz
}

test_image_list_remotes() {
# list images from the `images:` and `ubuntu-minimal:` builtin remotes if they are reachable

lxc remote list -f csv | while IFS=, read -r name url _; do
if [ "${name}" != "images" ] && [ "${name}" != "ubuntu-minimal" ]; then
continue
fi

# Check if there is connectivity
curl --head --silent "${url}" > /dev/null || continue

lxc image list "${name}:" > /dev/null
done
}

test_image_import_dir() {
Expand Down

0 comments on commit cf64979

Please sign in to comment.