Skip to content

Commit

Permalink
tests/vm: Add test for VM disconnection during lxc exec
Browse files Browse the repository at this point in the history
Signed-off-by: hamistao <[email protected]>
  • Loading branch information
hamistao committed Sep 12, 2024
1 parent b6c09a6 commit f706e03
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/vm
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit f706e03

Please sign in to comment.