From 9363ecb423b65349bbd40218b037eca92d948704 Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Wed, 3 Jul 2024 18:05:06 -0400 Subject: [PATCH] bin/test-image: do a post cloud-init reboot test for cloud variants Signed-off-by: Simon Deziel --- bin/test-image | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/bin/test-image b/bin/test-image index 5e2e4c3b9..c94eab366 100755 --- a/bin/test-image +++ b/bin/test-image @@ -268,6 +268,28 @@ for url in $(lxc query "/1.0/instances" | jq -r .[] | grep "${TEST_IMAGE}"); do fi done +# Check that cloud variants can be rebooted cleanly. +if [ "${VARIANT}" = "cloud" ]; then + for name in ${INSTANCES}; do + echo "==> Performing post cloud-init reboot test" + lxc exec "${name}" -- cloud-init status --wait --long + + # If systemd is available, use it to wait for any other job to complete before the restart + lxc exec "${name}" -- systemctl is-system-running --wait || true + + lxc restart "${name}" + waitInstanceReady "${name}" + + # cloud-init status. + if lxc exec "${name}" -- cloud-init status --wait --long; then + echo "===> PASS: cloud-init reboot: ${name}" + else + echo "===> FAIL: cloud-init reboot: ${name}" + FAIL=1 + fi + done +fi + # Check that all instances can be stopped. echo "==> Performing shutdown test" STOPPED=0