From a1b5220e40ad0f569f0ce839ee342014c92f4dc6 Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Tue, 10 Mar 2026 05:59:35 +0000 Subject: [PATCH] fix(test): prevent set -e from killing kubectl queries in test checks kubectl commands that query jobs or pod specs exit non-zero when the resource doesn't exist yet. Under set -e, a bare command substitution like var=$(kubectl ...) aborts the script silently. Add || true so the polling loop and assertion logic can handle failures gracefully. Co-Authored-By: Claude Opus 4.6 --- tests/k8s-deploy/run-deploy-test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/k8s-deploy/run-deploy-test.sh b/tests/k8s-deploy/run-deploy-test.sh index c6836ee1..39d50eba 100755 --- a/tests/k8s-deploy/run-deploy-test.sh +++ b/tests/k8s-deploy/run-deploy-test.sh @@ -210,7 +210,7 @@ fi # Check that the job completed successfully for i in {1..30}; do - job_status=$(kubectl get job ${deployment_id}-job-test-job -n laconic-${deployment_id} -o jsonpath='{.status.succeeded}' 2>/dev/null) + job_status=$(kubectl get job ${deployment_id}-job-test-job -n laconic-${deployment_id} -o jsonpath='{.status.succeeded}' 2>/dev/null || true) if [ "$job_status" == "1" ]; then break fi @@ -226,7 +226,7 @@ fi # Check that the secrets spec results in an envFrom secretRef on the pod secret_ref=$(kubectl get pod -n laconic-${deployment_id} -l app=${deployment_id} \ - -o jsonpath='{.items[0].spec.containers[0].envFrom[?(@.secretRef.name=="test-secret")].secretRef.name}' 2>/dev/null) + -o jsonpath='{.items[0].spec.containers[0].envFrom[?(@.secretRef.name=="test-secret")].secretRef.name}' 2>/dev/null || true) if [ "$secret_ref" == "test-secret" ]; then echo "secrets envFrom test: passed" else