diff --git a/tests/container b/tests/container index ffc3a9af9..5904d21c2 100755 --- a/tests/container +++ b/tests/container @@ -152,5 +152,18 @@ echo "==> Try cleanly stopping a container" lxc launch "${IMAGE}" c1 lxc restart c1 +echo "==> Test exit codes when container disconnects during lxc exec" + +# Try disconnecting a container stopping forcefully and gracefully to make sure they match. +(sleep 1 && lxc restart -f c1) & +lxc exec c1 -- sleep 10 || exitCode=$? +[ "${exitCode:-0}" -eq 129 ] + +(sleep 1 && lxc stop c1) & +lxc exec c1 -- sleep 10 || exitCode=$? +[ "${exitCode:-0}" -eq 129 ] + +lxc delete -f c1 + # shellcheck disable=SC2034 FAIL=0