Skip to content

Commit

Permalink
Improve VM stop reliability (#304)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomponline authored Oct 4, 2024
2 parents ad7765d + fe8f46f commit 4d2b616
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions tests/vm
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,17 @@ 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 1 && lxc stop -f vm1) &
lxc exec vm1 -- sleep 10 || exitCode=$?
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 1 && lxc stop vm1) &
lxc exec vm1 -- sleep 10 || exitCode=$?
(sleep 5 && lxc stop -f vm1) &
lxc exec vm1 -- sleep 60 || exitCode=$?
[ "${exitCode:-0}" -eq 129 ]
wait $!
fi
Expand Down

0 comments on commit 4d2b616

Please sign in to comment.