a few cleanups in the integration test runner script
DIR="$(realpath "$(dirname "${BASH_SOURCE[0]}")")"
-function _run_tests {
- local target=${1}
-
- local image_release
- case "$target" in
- bionic) image_release="18.04" ;;
- focal) image_release="20.04" ;;
- esac
+declare -A RELEASE_IMAGES=(
+ [bionic]="18.04"
+ [focal]="20.04"
+)
+
+function run_tests {
+ local target="$1"
+ local image="${RELEASE_IMAGES[$target]}"
local container_name
container_name="pylxd-$target-$(uuidgen | cut -d- -f1)"
- local container_image="ubuntu:${image_release}"
- echo "Running ${image_release} integration tests"
+ local container_image="ubuntu:${image}"
+ echo "Running ${image} integration tests"
- lxc launch "$container_image" "$container_name" -c security.nesting=true
+ lxc launch --ephemeral "$container_image" "$container_name" -c security.nesting=true
lxc exec "$container_name" -- cloud-init status --long --wait
lxc exec "$container_name" -- mkdir -p /opt/pylxd
@@ -38,6 +38,12 @@ function _run_tests {
lxc delete --force "$container_name"
}
-# run Bionic and then Focal integration tests
-_run_tests bionic
-_run_tests focal
+declare -a images
+if [ $# -gt 0 ]; then
+ images=("$@")
+else
+ images=("${!RELEASE_IMAGES[@]}")
+fi
+for image in "${images[@]}"; do
+ echo run_tests "$image"
+done
