diff --git a/tests/vm b/tests/vm index 862d5d376..3194d9f99 100644 --- a/tests/vm +++ b/tests/vm @@ -18,5 +18,21 @@ lxc stop vm1 lxc start 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 stop -f vm1) & +lxc exec vm1 -- sleep 10 || exitCode=$? +[ "${exitCode:-0}" -eq 129 ] + +wait $! +lxc start vm1 +waitInstanceBooted vm1 +(sleep 1 && lxc stop vm1) & +lxc exec vm1 -- sleep 10 || exitCode=$? +[ "${exitCode:-0}" -eq 129 ] + +wait $! +lxc delete -f vm1 + # shellcheck disable=SC2034 FAIL=0