From e6538b8bce1814471af2cd3467d5f4c6e863cb08 Mon Sep 17 00:00:00 2001 From: Adelina Tuvenie Date: Mon, 9 Aug 2021 22:48:11 +0300 Subject: [PATCH] Add trap to cri-integration test script The cri-integration.sh script sets errexit option. This does not work properly on Bash in Windows, espectially when the script is piped to something else ( tee in this case ). In this particular case, the problem arises from the fact that if the script exits prematurely, it will not get a chance to call test_teardown and thus clean the remaining containerd process, thus the whole command will hang indefinetly. Adding a simple trap on EXIT to call test_teardown will easily fix this. Signed-off-by: Adelina Tuvenie --- script/test/cri-integration.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script/test/cri-integration.sh b/script/test/cri-integration.sh index 5c50d207e..133e0d0be 100755 --- a/script/test/cri-integration.sh +++ b/script/test/cri-integration.sh @@ -21,6 +21,8 @@ set -o pipefail basedir="$(dirname "${BASH_SOURCE[0]}")" source "${basedir}/utils.sh" +trap test_teardown EXIT + ROOT="$( cd "${basedir}" && pwd )"/../.. cd "${ROOT}" @@ -46,6 +48,4 @@ ${sudo} bin/cri-integration.test --test.run="${FOCUS}" --test.v \ test_exit_code=$? -test_teardown - exit ${test_exit_code}