From feb18b9c460f8e42d3c7f4a3b4c93f94194d183b Mon Sep 17 00:00:00 2001 From: hamistao Date: Thu, 5 Sep 2024 22:31:38 -0300 Subject: [PATCH] tests/vm: Add test for VM disconnection during `lxc exec` Signed-off-by: hamistao --- tests/vm | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/vm b/tests/vm index 26648b0a6..4e7ba4940 100644 --- a/tests/vm +++ b/tests/vm @@ -17,5 +17,18 @@ waitInstanceReady vm1 lxc restart vm1 waitInstanceBooted vm1 +echo "==> Test lxc exec exit code upon VM disconnection due to a stop/reboot" +# Try disconnecting a VM stopping forcefully and gracefully to make sure they match. +(sleep 1 && lxc restart -f vm1) & +lxc exec vm1 -- sleep 10 || exitCode=$? +[ "${exitCode:-0}" -eq 129 ] + +waitInstanceBooted vm1 +(sleep 1 && lxc stop vm1) & +lxc exec vm1 -- sleep 10 || exitCode=$? +[ "${exitCode:-0}" -eq 129 ] + +lxc delete -f vm1 + # shellcheck disable=SC2034 FAIL=0