fix(e2e): Improve Diagnostics for y-stream Upgrade Tests #7177
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #7177"
general
weight: 0.35
moisescassidy
Jira: https://redhat.atlassian.net/browse/ARO-26775
Why
The current output of a failed e2e upgrade test is a single error string with no supporting state. ARO-26775 took four months and six Kusto queries across three databases to attribute, because all a failing run left behind was:
▎ Timed out after 2700.008s.
▎ VerifyHostedControlPlaneYStreamUpgrade(previousMinor=4.20.0, targetMinor=4.21.0) failed:
▎ clusterversion status.history has no version in target minor "4.21.0"
Nothing there says which phase consumed the 45 minutes. The facts that would — startedTime and completionTime per history entry — were being discarded before the history was logged. The missing information cost four months.
<img width="1208" height="615" alt="Screenshot From 2026-10-01 07-37-42" src="https://github.com/user-attachments/assets/dbb09690-3d25-4211-b191-c2f1df10a26b" />
What
clusterversion status.history is now rendered as one compact line carrying the timestamps, the release image, and the CVO Progressing message — logged on every observed change and appended to the failure the verifier returns:
▎ history is 4.21.13=Partial started=01:24:16 image=sha256:9d0436ae6f21; 4.20.20=Completed started=00:36:22 completed=01:24:16 image=sha256:1a59c7136e70; Progressing=True: Working towards 4.21.13: 150 of 900 done
Gomega surfaces only the last error from an Eventually, so carrying this state in the returned error is a targeted dump on failure that costs nothing while the test is passing.
The kube-apiserver verifier's failure now names both versions instead of saying only not updated (unchanged from pre-upgrade), and no longer re-logs an unchanged value on every poll.
Verification
Before the change — the history line repeated unchanged for ~45 minutes, with no timestamps to say which phase consumed the budget:
21:06:24 "clusterversion status after y-stream upgrade" history=[{4.20.40 Partial sha256:4b3ea4...}]
… identical at 21:08, 21:10, 21:12, 21:14, 21:16, 21:18, 21:20, 21:22 …
21:24:26 "clusterversion status after y-stream upgrade" history=[{4.21.35 Partial …} {4.20.40 Partial …}]
After the change — one line per transition, stamped with elapsed time, carrying the release payload digest, the calendar-dated stamps, and how far through the rollout the CVO is:
[VerifyHostedControlPlaneYStreamUpgrade(previousMinor=4.20.40, targetMinor=4.21.0)] +0s history is 4.20.40=Partial started=2026-10-14T04:29:54Z image=sha256:4b3ea4c81f2a
[VerifyHostedControlPlaneYStreamUpgrade(previousMinor=4.20.40, targetMinor=4.21.0)] +19m38s history is 4.21.35=Partial started=2026-10-14T04:49:32Z image=sha256:9d0436ae6f21; 4.20.40=Completed started=2026-10-14T04:29:54Z completed=2026-10-14T04:49:32Z image=sha256:4b3ea4c81f2a; Progressing=True: Working towards 4.21.35: 150 of 900 done (16% complete)
started=andcompleted=are emitted byrenderClusterVersionHistory(test/util/verifiers/hosted_control_plane_version.go). Timestamps are rendered RFC3339 with their dates:status.historyspans install through upgrade, so a time-only rendering of a run crossing UTC midnight reads as completed before it started.Polling moved inside the verifiers
The upgrade verifiers no longer wait correctly through a test-level
Eventuallywrapping
VerifyHCPCluster— the shapetest/AGENTS.mdprohibits, and the reason thestandard verifiers were sampling the cluster as it was before the upgrade. Instead:
VerifyHostedControlPlaneYStreamUpgrade,VerifyHostedControlPlaneZStreamUpgradeOnly,and
VerifyKubeAPIServerServerVersionUpgradednow take atimeout(must be > 0) andpoll via the shared
pollUntilReadyinpoll.go:DefaultPollIntervalbetweenchecks, failure diagnostics (above) on timeout or cancellation, and actual wall-clock
elapsed logged and reported on both success and failure.
pollUntilReadyperforms one post-deadline check (bounded byfinalCheckTimeout, 5s) so a rollout landing just inside the budget is not misreported as a timeout. The budget contract — verdict intimeout + finalCheckTimeout, plus at mostdiagnoseTimeouton the failure pathsonly, with diagnostics excluded from the reported elapsed — is documented on
pollUntilReadyand pinned by tests.is a realistic way these tests fail in CI), the verifier still gathers its diagnostics,
detached from the already-cancelled context and bounded by
diagnoseTimeout(
gatherDiagnosticsinpoll.go), so a suite-level cutoff leaves the same evidencea timeout does instead of a bare
context canceled.HCPClusterVersionUpgradeTimeout, then the kube-apiserver confirmation runs on whatis left of the same budget (floored at
minimumUpgradeConfirmationTimeout, 1m), andVerifyHCPClusterasserts viability only after the upgrade has been reported./versionreads go through the newframework.GetKubeAPIServerVersion(ctx, discovery), which bounds the request by thecaller's context —
discovery.ServerVersion()usescontext.TODO(), so a stalledrequest could previously outlive any deadline.
("expected the kube-apiserver ServerVersion to change from the pre-upgrade %q, still
observing %q") instead of only "not updated (unchanged from pre-upgrade)".
Delta-only transition logging
upgradePhaseReporteremits exactly one line per observed change in clusterversionstate, stamped with elapsed time on both
GinkgoLograndGinkgoWriter— no re-loggingof unchanged state, per the polling rules in
test/AGENTS.md. Every error the checkreturns is wrapped with the state it judged (
withClusterVersionSummary), so thetransient "not yet upgraded" verdicts a timeout surfaces carry the timestamps and the
Progressing message that separate a stalled rollout from a slow one.
Unit tests
test/util/verifiers/hosted_control_plane_version_test.go(new):-
TestRenderClusterVersionHistory— empty history, an in-progress entry with nocompletion stamp, the real ARO-26775 history, an entry with no timestamps or image,
same-version/different-payload pairs, an entry spanning UTC midnight, and a non-UTC
stamp normalised to UTC.
-
TestShortImageDigest— 12-character truncation, short digests, tag references,references with no path separator.
-
TestClusterVersionSummaryIncludesProgress/...WithoutProgress— theProgressing message is carried, and its absence leaves no dangling separator.
-
TestUpgradeCheckErrorsCarryHistory— every verdict branch (not-yet, missinginstall/target minor, unparseable, y-stream jump, downgrade, and the
Progressing-rides-along case) carries the state it judged.
-
TestUpgradePhaseReporterLogsOnlyOnChange— delta-only logging asserted on capturedwriter output.
test/util/verifiers/hosted_control_plane_version_verify_test.go(new): both upgradeverifiers fail over live polling (httptest) with history and Progressing in the error.
test/util/verifiers/poll_test.go(extended):TestPollUntilReady_SucceedsWhenConditionLandsAfterLastPoll(the near-miss),_OvershootIsBoundedByFinalCheckTimeout,_ReportedElapsedIncludesFinalCheck,_DiagnosticsAreBoundedAndExcludedFromElapsed,_StillFailsWhenConditionNeverHolds,and
_CancellationRunsDiagnostics(cancelling the caller's context mid-poll stillruns
diagnoseon a detached context and appends its output to the error).test/util/framework/kube_apiserver_version_test.go(new):TestGetKubeAPIServerVersionIsCancelledByContext(stalled server, caller deadline),TestGetKubeAPIServerVersionParsesResponse, andTestGetKubeAPIServerVersionWithoutRESTClient(nil-RESTClient guard).Mutation testing
Each of these reverts fails the corresponding test:
started=/completed=from the rendering →TestRenderClusterVersionHistoryupgradePhaseReporter.observe→TestUpgradePhaseReporterLogsOnlyOnChangeTestPollUntilReady_SucceedsWhenConditionLandsAfterLastPollTestPollUntilReady_DiagnosticsAreBoundedAndExcludedFromElapsedTestPollUntilReady_CancellationRunsDiagnosticsGetKubeAPIServerVersiontodiscovery.ServerVersion()-style unboundedreads →
TestGetKubeAPIServerVersionIsCancelledByContextChecks
go build ./...,go vet -tags E2Etests ./...,go test ./util/...(8 packages), andmake verify-gomega-assertionsare all clean atbfe81d3a6, which merges currentupstream/main(0f8ff9115).The merge also adapts
test/e2e/control_plane_version_pin.go— added tomainafterthis branch's last update — to
VerifyHostedControlPlaneZStreamUpgradeOnly's newtimeoutparameter; without it the merge build did not compile (all five required Prowjobs failed). Its call passes
minimumUpgradeConfirmationTimeout, since the twoEventuallyblocks above it have already established the state that verifier confirms.Scope
In-scope:
payload, Progressing) — logged on transitions and appended to verifier failures.
test-level
Eventuallywrappers: the verifiers take an explicittimeout, poll viapollUntilReady, and carry their own diagnostics and delta-only logging (pertest/AGENTS.md).the control-plane and kube-apiserver confirmation checks.
/versionread (framework.GetKubeAPIServerVersion) replacing unboundeddiscovery.ServerVersion()calls in the upgrade path.VerifyHCPClusterdocumentation of how waiting verifiers must be phased around it, plus afix so callers no longer append into the shared
standardVerifiersbacking array.test/e2e/control_plane_version_pin.go(new onmainsince this branch's lastupdate) to the z-stream verifier's new
timeoutparameter, so the merge withmainbuilds.
🤖 Generated with Claude Code