From c96f03439d762053852a90f9ea1b2e449b55daed Mon Sep 17 00:00:00 2001 From: hamistao Date: Fri, 6 Sep 2024 00:18:16 -0300 Subject: [PATCH] tests/container: Test container disconnect during exec Signed-off-by: hamistao --- tests/container | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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