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 <noreply@anthropic.com>feature/k8s-jobs
parent
464215c72a
commit
a1b5220e40
|
|
@ -210,7 +210,7 @@ fi
|
||||||
|
|
||||||
# Check that the job completed successfully
|
# Check that the job completed successfully
|
||||||
for i in {1..30}; do
|
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
|
if [ "$job_status" == "1" ]; then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
|
@ -226,7 +226,7 @@ fi
|
||||||
|
|
||||||
# Check that the secrets spec results in an envFrom secretRef on the pod
|
# 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} \
|
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
|
if [ "$secret_ref" == "test-secret" ]; then
|
||||||
echo "secrets envFrom test: passed"
|
echo "secrets envFrom test: passed"
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue