Skip to content

Commit

Permalink
test: Test exit codes upon container disconnect
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 f79b323 commit 617bb43
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/suites/exec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,15 @@ test_exec_exit_code() {
lxc exec x1 -- invalid-command || exitCode=$?
[ "${exitCode:-0}" -eq 127 ]

# Try disconnecting a container stopping forcefully and gracefully to make sure they differ appropriately.
(sleep 1 && lxc restart -f x1) &
lxc exec x1 -- sleep 10 || exitCode=$?
[ "${exitCode:-0}" -eq 137 ]

(sleep 1 && lxc stop x1) &
lxc exec x1 -- sleep 10 || exitCode=$?
# Both 129 and 143 have been seen and both make sense here.
[ "${exitCode:-0}" -eq 129 ]

lxc delete --force x1
}

0 comments on commit 617bb43

Please sign in to comment.