zjncs opened a new issue, #5625:
URL: https://github.com/apache/rocketmq-dashboard/issues/5625

   ## Description
   
   The details modal re-diagnoses every 2 seconds on a **real-timer interval** 
(`web/src/pages/instance/consumer.tsx:465-491`, `window.setInterval(() => void 
tick(), 2000)`), and each tick re-fetches subscriptions/progress with 
`force=true`. Five ConsumerPage tests that open the 详情 modal run with real 
timers, so under parallel load — whenever an interaction takes >2s — a tick 
lands mid-test:
   
   - **Mock theft**: the tick consumes a `mockResolvedValueOnce` entry the 
test's own action needed
   - **Mid-click DOM replacement**: the tick's state update re-renders between 
userEvent's pointerdown and click, so the click dispatches on a detached node
   
   Observed CI failures from two full parallel runs (7 and 9 failures): `keeps 
the latest client stack…` (`getConsumerStack` — Number of calls: 0), `loads a 
consumer client stack trace…`, `highlights inconsistent subscriptions…` 
(verdict never renders), `renders an unknown (-1) lag…`, `ignores settings 
responses…` (20s timeout). All pass in isolation.
   
   A sixth test (`refreshes the subscription verdict on the 2s modal 
auto-refresh`) is flaky in the other direction: it waits for 
`toHaveBeenCalledTimes(2)` on real time — a second tick makes the count jump 
1→3 and the assertion unsatisfiable (10s timeout).
   
   The repo already established the fix pattern for exactly this race — 
`ConsumerPageDiagnosticsRace.test.tsx:86-89` fakes only `setInterval` with a 
comment describing this precise failure.
   
   ## Expected behavior
   
   The six tests should be deterministic: fake only `setInterval` (keeping the 
modal's tick off wall-clock time, per the repo's own precedent) and, in the 
refresh test, drive the 2s tick explicitly with `advanceTimersByTimeAsync` and 
assert the refreshed verdict behavior rather than an exact call count.
   
   ## Environment
   
   - branch: master (0228dad5)
   - file: `web/src/pages/instance/__tests__/ConsumerPage.test.tsx` (tests at 
~1075/1158/1196/1248/1570/1652)


-- 
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]

Reply via email to