diff --git a/tests/k8s-deploy/run-deploy-test.sh b/tests/k8s-deploy/run-deploy-test.sh index 5cee371a..fdc5a1db 100755 --- a/tests/k8s-deploy/run-deploy-test.sh +++ b/tests/k8s-deploy/run-deploy-test.sh @@ -46,6 +46,18 @@ wait_for_log_output () { } +wait_for_cluster_destroyed () { + for i in {1..60} + do + if ! kind get clusters 2>/dev/null | grep -q .; then + return + fi + sleep 2 + done + echo "waiting for kind cluster cleanup: FAILED" + exit 1 +} + delete_cluster_exit () { $TEST_TARGET_SO deployment --dir $test_deployment_dir stop --delete-volumes exit 1 @@ -227,9 +239,10 @@ fi # Stop then start again and check the volume was preserved $TEST_TARGET_SO deployment --dir $test_deployment_dir stop -# Sleep a bit just in case -# sleep for longer to check if that's why the subsequent create cluster fails -sleep 20 +# Wait for the kind cluster to be fully destroyed before recreating it. +# Without this, the second 'kind create cluster' can fail with cgroup +# detection errors because Docker hasn't finished cleaning up. +wait_for_cluster_destroyed $TEST_TARGET_SO deployment --dir $test_deployment_dir start wait_for_pods_started wait_for_log_output