zjncs opened a new pull request, #5626: URL: https://github.com/apache/rocketmq-dashboard/pull/5626
Closes #5625 ## Problem The details modal re-diagnoses every 2s on a **real-timer interval** (`consumer.tsx:489`), so under parallel load a tick landed mid-test in five modal-opening tests — eating a queued `mockResolvedValueOnce` response or swapping the row under a click (`getConsumerStack` — Number of calls: 0; verdicts never rendering; 20s timeouts). The auto-refresh test was flaky in the other direction: its exact `toHaveBeenCalledTimes(2)` becomes unsatisfiable when a second tick lands (count jumps 1→3). Two full parallel runs produced **7 and 9 failures** across the known-flaky files; the ConsumerPage family is this change's target (deterministic 100% reproduction of the mechanism documented in the issue — open modal, let one real 2s tick land, click: the queued response is consumed and the verdict never renders). ## Fix (test-only, product code untouched) - The five modal tests now fake **only `setInterval`** — the exact pattern the repo's own `ConsumerPageDiagnosticsRace.test.tsx:86-89` established for this race (comment included), with `vi.useRealTimers()` restored in the shared `afterEach` - The auto-refresh test drives the 2s tick explicitly with `advanceTimersByTimeAsync(2000)` and asserts the refreshed verdict **behavior** (a fresh call after the tick + the reconciled verdict text) instead of an exact count; its mock returns the stale state on the first call and the reconciled state on every later call, so whichever sibling call lands last still yields the awaited verdict ## Verification - Full file in isolation: **36/36** - Targeted 4-file parallel pressure run (the flake conditions): **96/96, twice** - Full-suite parallel run: **zero ConsumerPage failures** (previously 5 flaky tests there); the 2 remaining failures are the known TopicPage/AlertsPage timeout-headroom family — a separate defect class, not touched by this change - `tsc --noEmit` clean; the change is confined to the test file ## Collision note The file is touched by 9 open PRs but all **add** tests (hunks @@325, @@1226, @@1381); this change modifies the six flaky test bodies (~1075-1325, ~1570, ~1652) — region-disjoint from every addition. Product file untouched. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
