From aac317503ea2eba68439bf1d49e413d26f2aa96c Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Tue, 10 Mar 2026 07:01:27 +0000 Subject: [PATCH] fix(test): wait for namespace termination before restart Replace fixed sleep with a polling loop that waits for the deployment namespace to be fully deleted. Without this, the start command fails with 403 Forbidden because k8s rejects resource creation in a namespace that is still terminating. Co-Authored-By: Claude Opus 4.6 --- tests/k8s-deploy/run-deploy-test.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/k8s-deploy/run-deploy-test.sh b/tests/k8s-deploy/run-deploy-test.sh index 942110d4..cfc03138 100755 --- a/tests/k8s-deploy/run-deploy-test.sh +++ b/tests/k8s-deploy/run-deploy-test.sh @@ -230,7 +230,15 @@ fi # Use --delete-volumes to clear PVs so fresh PVCs can bind on restart. # Bind-mount data survives on the host filesystem; provisioner volumes are recreated fresh. $TEST_TARGET_SO deployment --dir $test_deployment_dir stop --delete-volumes --skip-cluster-management -sleep 5 +# Wait for the namespace to be fully terminated before restarting. +# Without this, 'start' fails with 403 Forbidden because the namespace +# is still in Terminating state. +for i in {1..60}; do + if ! kubectl get namespace laconic-${deployment_id} 2>/dev/null | grep -q .; then + break + fi + sleep 2 +done $TEST_TARGET_SO deployment --dir $test_deployment_dir start --skip-cluster-management wait_for_pods_started wait_for_log_output