Skip to content

Commit

Permalink
tests/vm: test clean shutdown before abrupt one
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
simondeziel committed Oct 3, 2024
1 parent 570f329 commit fe8f46f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tests/vm
Original file line number Diff line number Diff line change
Expand Up @@ -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 $!
Expand Down

0 comments on commit fe8f46f

Please sign in to comment.