Frun1na opened a new pull request, #6780:
URL: https://github.com/apache/rocketmq-dashboard/pull/6780
### Which Issue(s) This PR Fixes
- Fixes #6778
### Brief Description
The mock branch of `getNameServerConfigDiff` answered with three compared
keys - `listenPort`, `serverWorkerThreads` and `clientRequestThreadPoolNums` -
while the endpoint answers with the 19 keys `NameServerConfigDiffService` loads
from `server/src/main/resources/cluster/nameserver-safe-config-keys.yml`. The
drift panel renders `comparedKeys` as chips
(`web/src/pages/cluster/index.tsx:996`), so the demo advertised a comparison
the service never performs: `clientRequestThreadPoolNums` is not in the
whitelist, and the other 17 whitelisted keys were missing.
`web/src/services/clusterService.ts` now returns that whitelist via
`nameserverComparedKeys()`, and the new test pins the mock list to the server
resource itself, so the two cannot drift apart again - the same rule the
neighbouring mock parity change #5486 applies to the config queue counts.
No user-visible change outside mock-data mode; the endpoint response is
untouched.
### How Did You Test This Change?
```
$ cd web && npx vitest run src/services/clusterService.test.ts
✓ src/services/clusterService.test.ts (9 tests) 13ms
Test Files 1 passed (1)
Tests 9 passed (9)
```
The mapped checks for the two changed web files:
```
$ npx eslint src/services/clusterService.test.ts
src/services/clusterService.ts # clean
$ npx prettier --check src/services/clusterService.test.ts
src/services/clusterService.ts
Checking formatting...
All matched files use Prettier code style!
$ npx vitest related --run src/services/clusterService.test.ts
src/services/clusterService.ts
Test Files 8 passed (8) # includes the cluster page suite
Tests 135 passed (135)
$ npx tsc -b # clean
```
The new test fails without the fix (only the mock file reverted, test kept):
```
$ git checkout -- web/src/services/clusterService.ts
$ npx vitest run src/services/clusterService.test.ts
FAIL src/services/clusterService.test.ts > clusterService mock clusters >
advertises the NameServer comparison scope the endpoint reports
AssertionError: expected [ 'listenPort', …(2) ] to deeply equal [
'listenPort', …(18) ]
- Expected
+ Received
[
"listenPort",
"serverWorkerThreads",
- "serverCallbackExecutorThreads",
- "serverSelectorThreads",
- "serverOnewaySemaphoreValue",
- "serverAsyncSemaphoreValue",
- "serverChannelMaxIdleTimeSeconds",
- "serverSocketSndBufSize",
- "serverSocketRcvBufSize",
- "serverPooledByteBufAllocatorEnable",
- "useEpollNativeSelector",
- "orderMessageEnable",
- "returnOrderTopicConfigToBroker",
- "enableControllerInNamesrv",
- "enableUncleanMasterElection",
- "notifyMinBrokerIdChanged",
- "supportActingMaster",
- "scanNotActiveBrokerInterval",
- "unRegisterBrokerQueueCapacity",
+ "clientRequestThreadPoolNums",
]
Test Files 1 failed (1)
Tests 1 failed | 8 passed (9)
```
The assertion compares the mock's list with the server's whitelist, so it
goes red exactly when the mock stops naming the keys the service compares;
restoring the fix turns it green again.
### Checklist
- [x] One coherent change; unrelated modifications are not bundled in
- [x] Commit subject follows Conventional Commits (`feat:` / `fix:` /
`refactor:` / `chore:` / `docs:` / `perf:`)
- [x] Tests added or updated for non-trivial changes, test methods named
`...Test`
- [ ] New UI text has both Chinese and English entries under `web/src/i18n/`
- [ ] Architecture constraints stay green (`mvn test` runs the ArchUnit
checks)
- [ ] New source files carry the ASF license header
- [ ] Documentation touched where behaviour changed (README / `docs/` /
in-app help)
--
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]