From 9a612c8283362a440fcc81d875a0b6156fb0ee59 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 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/container b/tests/container index f2d35535b..f3721b507 100755 --- a/tests/container +++ b/tests/container @@ -147,5 +147,15 @@ lxc exec u1 -- mkdir /root/sys lxc exec u1 -- mount -t sysfs sysfs /root/sys lxc delete -f u1 +echo "==> Test exit codes when container disconnects during lxc exec" +lxc launch "${IMAGE}" c1 + +(sleep 1 && lxc stop -f c1) & +lxc exec c1 -- sleep 10 || exitCode=$? +# The expected signal is a 137 indicating a SIGKILL. +[ "${exitCode:-0}" -eq 137 ] + +lxc delete -f c1 + # shellcheck disable=SC2034 FAIL=0