From 570f329a8a9d5995f6fe6c6b64e5f0186c500558 Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Thu, 3 Oct 2024 15:14:08 -0400 Subject: [PATCH 1/2] tests/vm: allow more time for the guest exec sleep to start Signed-off-by: Simon Deziel --- tests/vm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/vm b/tests/vm index eb8dcf24..e58c76d3 100644 --- a/tests/vm +++ b/tests/vm @@ -22,15 +22,15 @@ if ! echo "${LXD_SNAP_CHANNEL}" | grep -qE '^4\.0/'; then waitInstanceBooted vm1 # Try disconnecting a VM stopping forcefully and gracefully to make sure they match. - (sleep 1 && lxc stop -f vm1) & - lxc exec vm1 -- sleep 10 || exitCode=$? + (sleep 5 && lxc stop -f vm1) & + lxc exec vm1 -- sleep 60 || exitCode=$? [ "${exitCode:-0}" -eq 129 ] - wait $! + lxc start vm1 waitInstanceBooted vm1 - (sleep 1 && lxc stop vm1) & - lxc exec vm1 -- sleep 10 || exitCode=$? + (sleep 5 && lxc stop vm1) & + lxc exec vm1 -- sleep 60 || exitCode=$? [ "${exitCode:-0}" -eq 129 ] wait $! fi From fe8f46f8fdc2a2b53cda2434d2e282c412ffee66 Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Thu, 3 Oct 2024 14:50:56 -0400 Subject: [PATCH 2/2] tests/vm: test clean shutdown before abrupt one This way, we only start an instance that was cleanly shutdown rather than risking to meet with a corrupted FS needing fsck'ing. Also add echos to track where we're at. Signed-off-by: Simon Deziel --- tests/vm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/vm b/tests/vm index e58c76d3..d08c6f52 100644 --- a/tests/vm +++ b/tests/vm @@ -21,15 +21,16 @@ if ! echo "${LXD_SNAP_CHANNEL}" | grep -qE '^4\.0/'; then lxc start vm1 waitInstanceBooted vm1 - # Try disconnecting a VM stopping forcefully and gracefully to make sure they match. - (sleep 5 && lxc stop -f vm1) & + echo "==> Test lxc exec exit code when stopping the VM cleanly" + (sleep 5 && lxc stop vm1) & lxc exec vm1 -- sleep 60 || exitCode=$? [ "${exitCode:-0}" -eq 129 ] wait $! + echo "==> Test lxc exec exit code when stopping the VM abruptly" lxc start vm1 waitInstanceBooted vm1 - (sleep 5 && lxc stop vm1) & + (sleep 5 && lxc stop -f vm1) & lxc exec vm1 -- sleep 60 || exitCode=$? [ "${exitCode:-0}" -eq 129 ] wait $!