Frun1na opened a new pull request, #4787:
URL: https://github.com/apache/rocketmq-dashboard/pull/4787

   ### Which Issue(s) This PR Fixes
   
   (filled with the issue number right after the issue is filed)
   
   ### Brief Description
   
   Two test-only fixtures pinned values the backend never sends — the same 
mock-vs-contract family
   as #4732's review item 4 and #4762:
   
   **`web/src/mock/audit.ts`.** Mock mode derives the audit filter options from 
these rows
   (`getMockAuditFilterOptions` in `services/opsService.ts`), so the offered 
filters advertised
   operations that cannot exist:
   
   - `RESTART_BROKER` (2 rows): `git grep RESTART_BROKER -- 
server/src/main/java` finds no producer;
     it is absent from `OperationAuditConstants` and from every 
`auditService.record(...)` call.
     Replaced with the real `RESEND_DLQ`/`DLQ` and `ADD_PROXY_ADDRESS`/`PROXY` 
pairs
     (`RocketMQDLQProvider.java:695`, 
`OperationAuditConstants.Operation.ADD_PROXY_ADDRESS`).
   - `UPDATE_ACL` + resourceType `TOPIC` (2 rows): ACL changes are recorded as
     `CREATE_ACL_RULE`/`UPDATE_ACL_RULE`/`DELETE_ACL_RULE` against `ACL_RULE`
     (`AclService.java:117,158,172`), with the rule id as the target. The 
fixtures now use
     `UPDATE_ACL_RULE`/`ACL_RULE` with id targets.
   - `UPDATE_BROKER_CONFIG` + resourceType `CLUSTER`: the service records it 
against `BROKER`
     (`RocketMQBrokerConfigService.java:94`); `UPDATE_CLUSTER_CONFIG`/`CLUSTER` 
is the separate,
     real pair (`ClusterService.java:414`) and stays as-is.
   
   **`web/src/api/clusterContract.test.ts`.** The "contract" fixture pinned 
`status: 'RUNNING'` on
   the cluster, its broker, its proxy and its NameServer — a value the API 
never serializes:
   `ClusterStatus` is `healthy/warning/error/offline` and `BrokerStatus` is
   `running/readonly/maintenance`. The fixture now uses the real values, so the 
contract test pins
   the actual contract instead of a hypothetical one.
   
   ### How Did You Test This Change?
   
   ```
   $ npx vitest run src/services/opsService.test.ts 
src/api/clusterContract.test.ts
    Test Files  2 passed (2)
         Tests  15 passed (15)
   
   $ npx tsc --noEmit        # no output, exit 0
   $ npx eslint src/mock/audit.ts src/api/clusterContract.test.ts   # no 
findings
   ```
   
   The `derives complete filter options from the default audit records` test 
still passes because
   `CREATE_TOPIC`, `DELETE_GROUP`, `RESET_OFFSET`, `CLUSTER`, `TOPIC`, `GROUP` 
remain represented by
   real rows.
   
   ### Checklist
   
   - [x] One coherent change; unrelated modifications are not bundled in
   - [x] Commit subject follows Conventional Commits (`test:`)
   - [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/` 
(no UI text touched)
   - [ ] Architecture constraints stay green (`mvn test` runs the ArchUnit 
checks)
   - [ ] New source files carry the ASF license header (no new source files)
   - [ ] Documentation touched where behaviour changed (no behaviour change; 
test/mock only)
   


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