From 6d2e5900d3debb5b59cba296c84c8d7ea0070f23 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Wed, 17 Jul 2024 16:03:42 -0700 Subject: [PATCH] tests/int/hooks: fix failed hooks test When reviewing PR 4348, I noticed that it removed the call to parent.terminate when a hook has failed. Yet, this test case did not catch that issue. Add the check that the container was never fully started after a hook failure. Signed-off-by: Kir Kolyshkin --- tests/integration/hooks.bats | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/integration/hooks.bats b/tests/integration/hooks.bats index 099337a2b2c..ebb2e9a1eae 100644 --- a/tests/integration/hooks.bats +++ b/tests/integration/hooks.bats @@ -37,8 +37,12 @@ function teardown() { # shellcheck disable=SC2016 update_config '.hooks |= {"'$hook'": [{"path": "/bin/true"}, {"path": "/bin/false"}]}' runc run "test_hook-$hook" - [[ "$output" != "Hello World" ]] [ "$status" -ne 0 ] + [[ "$output" != *"Hello World"* ]] [[ "$output" == *"error running $hook hook #1:"* ]] + # Check the container was never started. + runc delete "test_hook-$hook" + [ "$status" -eq 1 ] + [[ "$output" == *"container does not exist"* ]] done }