Skip to content

Commit 67b1a96

Browse files
myasnikovdaniillexfrei
authored andcommitted
test(e2e): fail install test when HelmReleases are not Ready
The HR readiness gate in e2e-install-cozystack.bats was toothless in two layers: the backgrounded kubectl-wait fan-out discarded child exit codes (POSIX `wait` without args returns 0), and the final check echoed "Some HelmReleases failed to reconcile" without exiting non-zero — a regression from 1f24038, which replaced the unavailable bats `fail` helper with a bare echo. A permanently-failing platform HelmRelease (e.g. the backup-controller CRD rejection, #2822) shipped through green CI for weeks. Replace the fan-out with a single `kubectl wait hr --all -A` for trace visibility, gate on an outcome-based re-list (which also covers HRs created after the snapshot, with a 120s retry to absorb momentary drift-reconcile flaps), and dump the full Ready condition message per non-ready HR so the real error is visible in the test output. Refs #2822 Assisted-By: Claude <[email protected]> Signed-off-by: Myasnikov Daniil <[email protected]>
1 parent 2363f2d commit 67b1a96

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

‎hack/e2e-install-cozystack.bats‎

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,9 @@ EOF
109109
# signal for "all platform HRs have been emitted" without hard-coding the
110110
# expected list, so the 5s pad lets a few late-arrivals join the snapshot.
111111
sleep 5
112-
kubectl get hr -A | awk 'NR>1 {print "kubectl wait --timeout=15m --for=condition=ready -n "$1" hr/"$2" &"} END {print "wait"}' | sh -ex
112+
# Pacing only: names every HR that timed out in the trace; the authoritative
113+
# gate re-lists below, covering HRs created after this snapshot (#2822).
114+
kubectl wait hr --all -A --timeout=15m --for=condition=ready || true
113115

114116
echo "Waiting for post-install-prep to complete"
115117
if ! wait $POST_PREP_PID; then
@@ -119,10 +121,20 @@ EOF
119121
fi
120122
cat /tmp/post-install-prep.log
121123

122-
# Fail the test if any HelmRelease is not Ready
123-
if kubectl get hr -A | grep -v " True " | grep -v NAME; then
124-
kubectl get hr -A
124+
# Fail the test if any HelmRelease is not Ready. Wait again on a fresh
125+
# listing so HelmReleases created after the snapshot above are gated too;
126+
# the window absorbs momentary Unknown flaps from drift reconciles.
127+
if ! kubectl wait hr --all -A --timeout=15m --for=condition=ready; then
128+
kubectl get hr -A || true
129+
# kubectl's STATUS column truncates long messages; dump the full Ready
130+
# condition per non-ready HR so the real error (e.g. a rejected CRD) is
131+
# visible in the test output instead of only inside the cozyreport.
132+
kubectl get hr -A --no-headers | awk '$4 != "True"' | while read -r ns name _; do
133+
echo "--- Non-ready HelmRelease: $ns/$name" >&2
134+
kubectl get hr -n "$ns" "$name" -o jsonpath='{range .status.conditions[*]}{.type}={.status} reason={.reason}: {.message}{"\n"}{end}' >&2 || true
135+
done
125136
echo "Some HelmReleases failed to reconcile" >&2
137+
exit 1
126138
fi
127139
}
128140

0 commit comments

Comments
 (0)