You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "Frun1na (via GitHub)" <gi...@apache.org> on 2026/10/01 15:23:47 UTC

[PR] test(web): pin mock and contract values to what the backend records [rocketmq-dashboard]

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

   ### Which Issue(s) This PR Fixes
   
   - Fixes #5280
   
   ### 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)
   
   ---
   
   Re-submission of #4787: the original PR was closed by the stale bot after 7 days without review activity, and GitHub now rejects reopening pull requests in this repository ("state cannot be changed"), so the same change is re-submitted rebased onto the current `rocketmq-studio` tip (`a460673f`). The original review thread stays available at #4787.
   


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] test(web): pin mock and contract values to what the backend records [rocketmq-dashboard]

Posted by "lizhimins (via GitHub)" <gi...@apache.org>.
lizhimins commented on PR #5281:
URL: https://github.com/apache/rocketmq-dashboard/pull/5281#issuecomment-6079984500

   Merged as part of #5260 (squashed into `rocketmq-studio` as 809c40916).
   
   It corrected two rows of the audit mock to operation codes the server actually writes - `CREATE_ACL_RULE` / `ACL_RULE` and `RELOAD_PROXY_CONFIG` / `PROXY` - instead of `UPDATE_ACL` / `RESTART_BROKER`, which no code path produces.
   
   We are consolidating same-author changes into one commit rather than landing several near-identical ones on the trunk; your commit is preserved as the author of the corresponding part of that change. Closing - no action needed, and thanks for the fix.


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] test(web): pin mock and contract values to what the backend records [rocketmq-dashboard]

Posted by "Frun1na (via GitHub)" <gi...@apache.org>.
Frun1na commented on PR #5281:
URL: https://github.com/apache/rocketmq-dashboard/pull/5281#issuecomment-6044111833

   Friendly ping — this is still open for review whenever you get a chance. (Keeping it from the stale bot for now.)


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] test(web): pin mock and contract values to what the backend records [rocketmq-dashboard]

Posted by "lizhimins (via GitHub)" <gi...@apache.org>.
lizhimins closed pull request #5281: test(web): pin mock and contract values to what the backend records
URL: https://github.com/apache/rocketmq-dashboard/pull/5281


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org