mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-31 16:36:38 +00:00
Merge pull request #9982 from ChengyuZhu6/fix-ci
tests: Delete test scripts forcely
This commit is contained in:
@@ -361,6 +361,17 @@ function set_default_cluster_namespace() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function delete_test_cluster_namespace() {
|
function delete_test_cluster_namespace() {
|
||||||
set_default_cluster_namespace
|
|
||||||
kubectl delete namespace "${TEST_CLUSTER_NAMESPACE}"
|
kubectl delete namespace "${TEST_CLUSTER_NAMESPACE}"
|
||||||
|
set_default_cluster_namespace
|
||||||
|
}
|
||||||
|
|
||||||
|
function delete_test_runners(){
|
||||||
|
echo "Delete test scripts"
|
||||||
|
local scripts_names=( "run_kubernetes_tests.sh" "bats" )
|
||||||
|
for script_name in "${scripts_names[@]}"; do
|
||||||
|
pids=$(pgrep -f ${script_name})
|
||||||
|
if [ -n "$pids" ]; then
|
||||||
|
echo "$pids" | xargs sudo kill -SIGTERM >/dev/null 2>&1 || true
|
||||||
|
fi
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
@@ -450,6 +450,10 @@ function cleanup() {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# In case of canceling workflow manually, 'run_kubernetes_tests.sh' continues running and triggers new tests,
|
||||||
|
# resulting in the CI being in an unexpected state. So we need kill all running test scripts before cleaning up the node.
|
||||||
|
# See issue https://github.com/kata-containers/kata-containers/issues/9980
|
||||||
|
delete_test_runners || true
|
||||||
# Switch back to the default namespace and delete the tests one
|
# Switch back to the default namespace and delete the tests one
|
||||||
delete_test_cluster_namespace || true
|
delete_test_cluster_namespace || true
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user