Skip to content

Commit e6538b8

Browse files
author
Adelina Tuvenie
committed
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 <[email protected]>
1 parent 218db0f commit e6538b8

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

script/test/cri-integration.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ set -o pipefail
2121
basedir="$(dirname "${BASH_SOURCE[0]}")"
2222
source "${basedir}/utils.sh"
2323

24+
trap test_teardown EXIT
25+
2426
ROOT="$( cd "${basedir}" && pwd )"/../..
2527
cd "${ROOT}"
2628

@@ -46,6 +48,4 @@ ${sudo} bin/cri-integration.test --test.run="${FOCUS}" --test.v \
4648

4749
test_exit_code=$?
4850

49-
test_teardown
50-
5151
exit ${test_exit_code}

0 commit comments

Comments
 (0)