unbridled-41 commented on PR #5918:
URL:
https://github.com/apache/rocketmq-dashboard/pull/5918#issuecomment-6091085530
### Follow-up review of this fix: the sort assertion could not fail
The test's "a descending sort must not promote the unmeasured broker either"
step asserted `不可用` on the unmeasured row *after* the sort, but the fixture
contained only that one broker. With nothing to compare against, both the
ascending and the descending pass, so the direction handling in
`compareBrokerStats` — the part of the fix that is easy to get wrong, because
Ant Design negates the comparator for `descend`
(`antd/es/table/hooks/useSorter.js`: `sortOrder === ASCEND ? compareResult :
-compareResult`) — was not covered at all.
Commit `749022f9` fixes the fixture in this branch (first commit `eb6df760`
untouched, no force-push): a second broker with measured stats
(`runtimeStatsAvailable: true`, `tpsIn: 950,000`) now sits next to the
unmeasured one, and the test asserts, in both directions, that the measured
broker stays above the unmeasured one — plus that the measured row renders its
value and no `不可用`.
Red/green, both observed locally:
```
# with the direction inversion removed (unavailableAfterAvailable = 1 for
both orders)
cd web && npx vitest run src/pages/cluster/__tests__/ClusterPage.test.tsx -t
'reports a failed broker runtime-stats'
AssertionError: expected 2 to be less than 1
Tests 1 failed | 30 skipped (31) <- the descending step now bites
# with 749022f9
cd web && npx vitest run src/pages/cluster/__tests__/ClusterPage.test.tsx
Test Files 1 passed (1)
Tests 31 passed (31)
```
`npx tsc -b` and `npx eslint` on the test file are clean.
Branch `fix/cluster-broker-stats-unavailable`, HEAD `749022f9` (on top of
`eb6df760`).
--
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]