try to ensure the log stream survives long silences

This commit is contained in:
E M 2026-04-30 12:57:05 +10:00
parent b78c2d5301
commit abaad73465
No known key found for this signature in database

View File

@ -351,13 +351,25 @@ jobs:
- name: Stream test logs
run: |
kubectl logs -l job-name=$NAMEPREFIX \
-n default \
--follow
POD=$(kubectl get pods -l job-name=$NAMEPREFIX -n default \
-o jsonpath='{.items[0].metadata.name}')
echo "Streaming logs for pod: $POD"
# Use pod name (not label selector) so the stream survives long silences
# between test completions. || true so the step doesn't fail if the
# API server closes the connection before the pod exits.
kubectl logs $POD -n default --follow || true
- name: Check job status
run: |
sleep 5
# kubectl logs may have exited early (API server closed the stream).
# Wait for the job to reach a terminal state before checking the result.
kubectl wait job/$NAMEPREFIX -n default \
--for=condition=complete,failed \
--timeout=3300s
# Give the Cloud Logging agent time to export the final log burst
# (NUnit pass/fail lines written near pod exit) before Terraform
# destroy removes the cluster.
sleep 60
job_status=$(kubectl get jobs $NAMEPREFIX -n default \
-o jsonpath='{.status.conditions[0].type}')
echo "Job status: $job_status"