← Back to Pull requests

fix(e2e): Improve Diagnostics for y-stream Upgrade Tests #7177

Closed
unknown closed this pull request without merging on Oct 28, 2026 18:27 UTC
View on GitHub
unknown unknown commented on Sep 25, 2026 16:47 UTC
Author

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

  • Timestamps are the new information, and the reason the old helper is deleted.

  • The image is carried over from the rendering this replaces, abbreviated to the leading 12 characters of the digest.

  • Progressing is new. It reports how far through the rollout the CVO is, which is what distinguishes a stalled upgrade from a slow one.
  • 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= and completed= are emitted by renderClusterVersionHistory (test/util/verifiers/hosted_control_plane_version.go). Timestamps are rendered RFC3339 with their dates: status.history spans 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 Eventually
    wrapping VerifyHCPCluster — the shape test/AGENTS.md prohibits, and the reason the
    standard verifiers were sampling the cluster as it was before the upgrade. Instead:

  • VerifyHostedControlPlaneYStreamUpgrade, VerifyHostedControlPlaneZStreamUpgradeOnly,

  • and VerifyKubeAPIServerServerVersionUpgraded now take a timeout (must be > 0) and
    poll via the shared pollUntilReady in poll.go: DefaultPollInterval between
    checks, failure diagnostics (above) on timeout or cancellation, and actual wall-clock
    elapsed logged and reported on both success and failure.
  • pollUntilReady performs one post-deadline check (bounded by finalCheckTimeout, 5s) so a rollout landing just inside the budget is not misreported as a timeout. The budget contract — verdict in

  • timeout + finalCheckTimeout, plus at most diagnoseTimeout on the failure paths
    only, with diagnostics excluded from the reported elapsed — is documented on
    pollUntilReady and pinned by tests.
  • When the caller's context is cancelled mid-poll (a Ginkgo suite or spec timeout firing

  • 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
    (gatherDiagnostics in poll.go), so a suite-level cutoff leaves the same evidence
    a timeout does instead of a bare context canceled.
  • The minor-upgrade e2e specs are now phased: the control-plane verifier polls with

  • HCPClusterVersionUpgradeTimeout, then the kube-apiserver confirmation runs on what
    is left of the same budget (floored at minimumUpgradeConfirmationTimeout, 1m), and
    VerifyHCPCluster asserts viability only after the upgrade has been reported.
  • Pre-upgrade /version reads go through the new

  • framework.GetKubeAPIServerVersion(ctx, discovery), which bounds the request by the
    caller's context — discovery.ServerVersion() uses context.TODO(), so a stalled
    request could previously outlive any deadline.
  • The kube-apiserver failure message names both versions

  • ("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

    upgradePhaseReporter emits exactly one line per observed change in clusterversion
    state, stamped with elapsed time on both GinkgoLogr and GinkgoWriter — no re-logging
    of unchanged state, per the polling rules in test/AGENTS.md. Every error the check
    returns is wrapped with the state it judged (withClusterVersionSummary), so the
    transient "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 no
    completion 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 — the
    Progressing message is carried, and its absence leaves no dangling separator.
    - TestUpgradeCheckErrorsCarryHistory — every verdict branch (not-yet, missing
    install/target minor, unparseable, y-stream jump, downgrade, and the
    Progressing-rides-along case) carries the state it judged.
    - TestUpgradePhaseReporterLogsOnlyOnChange — delta-only logging asserted on captured
    writer output.
  • test/util/verifiers/hosted_control_plane_version_verify_test.go (new): both upgrade

  • verifiers 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 still
    runs diagnose on 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, and
    TestGetKubeAPIServerVersionWithoutRESTClient (nil-RESTClient guard).

    Mutation testing

    Each of these reverts fails the corresponding test:

  • dropping started=/completed= from the rendering → TestRenderClusterVersionHistory

  • removing the delta-only guard in upgradePhaseReporter.observe →

  • TestUpgradePhaseReporterLogsOnlyOnChange
  • removing the post-deadline final check → TestPollUntilReady_SucceedsWhenConditionLandsAfterLastPoll

  • letting diagnostics count toward the reported elapsed or overrun their timeout →

  • TestPollUntilReady_DiagnosticsAreBoundedAndExcludedFromElapsed
  • returning from the cancellation branch without gathering diagnostics →

  • TestPollUntilReady_CancellationRunsDiagnostics
  • reverting GetKubeAPIServerVersion to discovery.ServerVersion()-style unbounded

  • reads → TestGetKubeAPIServerVersionIsCancelledByContext

    Checks

    go build ./..., go vet -tags E2Etests ./..., go test ./util/... (8 packages), and
    make verify-gomega-assertions are all clean at bfe81d3a6, which merges current
    upstream/main (0f8ff9115).

    The merge also adapts test/e2e/control_plane_version_pin.go — added to main after
    this branch's last update — to VerifyHostedControlPlaneZStreamUpgradeOnly's new
    timeout parameter; without it the merge build did not compile (all five required Prow
    jobs failed). Its call passes minimumUpgradeConfirmationTimeout, since the two
    Eventually blocks above it have already established the state that verifier confirms.

    Scope

    In-scope:

  • Diagnostic rendering of clusterversion status.history and conditions (timestamps, release

  • payload, Progressing) — logged on transitions and appended to verifier failures.
  • Verifier-owned polling for the three control-plane upgrade verifiers, replacing the

  • test-level Eventually wrappers: the verifiers take an explicit timeout, poll via
    pollUntilReady, and carry their own diagnostics and delta-only logging (per test/AGENTS.md).
  • Phasing of the affected control-plane upgrade e2e specs, and a shared upgrade budget between

  • the control-plane and kube-apiserver confirmation checks.
  • A context-bounded /version read (framework.GetKubeAPIServerVersion) replacing unbounded

  • discovery.ServerVersion() calls in the upgrade path.
  • VerifyHCPCluster documentation of how waiting verifiers must be phased around it, plus a

  • fix so callers no longer append into the shared standardVerifiers backing array.
  • Adapting test/e2e/control_plane_version_pin.go (new on main since this branch's last

  • update) to the z-stream verifier's new timeout parameter, so the merge with main
    builds.

    🤖 Generated with Claude Code

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: moisescassidy Review duration: 47620m
    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
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 20.5% · Safe to merge
    20.5%
    Repository