Frun1na opened a new issue, #6785: URL: https://github.com/apache/rocketmq-dashboard/issues/6785
### Before Creating the Bug Report - [x] I have searched the [open issues](https://github.com/apache/rocketmq-dashboard/issues) of this repository and believe that this is not a duplicate. - [x] This is a defect in RocketMQ Studio, not a usage question and not a defect in another Apache RocketMQ repository. - [x] I can reproduce this on the current `rocketmq-studio` branch, or I have stated the exact version I am running below. ### Studio Version branch: rocketmq-studio git commit id: a92c2314 deployed as: built from source (the web service module only, no server or web dev server running) ### Runtime Environment OS: Ubuntu on WSL2 (linux/amd64) MySQL: not applicable - the defect is in the web mock data source browser (for UI issues): not applicable - reproduced by a unit test against the mock branch ### Connected RocketMQ Cluster not applicable - no cluster is reached; the defect is that the demo answers a probe the endpoint would refuse ### Describe the Bug In mock-data mode the cluster page's "test connection" form answers a successful probe for a blank NameServer address. The form's rule is `rules={[{ required: true, message: t('cluster.nsAddrPlaceholder') }]}` (`web/src/pages/cluster/index.tsx:2040`) without `whitespace: true`; the validator Ant uses (`@rc-component/async-validator`) rejects only the empty string, so a whitespace-only value passes validation and `testClusterConnection(' ')` runs. The mock branch (`web/src/services/clusterService.ts:83-94`) trims to an empty string, finds nothing to reject, and returns `connected: true` with an empty `namesrvAddr` and the demo cluster's broker list, so the page shows a success toast and a probe result. The endpoint refuses exactly that request: `TestConnectionDTO` declares `@NotBlank namesrvAddr` (`server/src/main/java/org/apache/rocketmq/studio/cluster/broker/TestConnectionDTO.java`), so a blank address is 400 `namesrvAddr is required`. The sibling mock for the same parameter already mirrors the endpoint - `connectionsService.listConnections` throws `namesrvAddr is required` for a blank address, and its test is literally named "requires the same NameServer parameter as the real endpoint". ### Steps to Reproduce 1. Switch the app to mock data mode and open the cluster page. 2. In the "test connection" panel type a space (or several) into the NameServer address field and submit: the form accepts it. 3. Observe the success toast and the probe result card for an address that is empty after trimming - `connected: true`, `namesrvAddr: ""`, `brokerCount: 8`. 4. Or run the unit test that pins the contract: `cd web && npx vitest run src/services/clusterService.test.ts` (case `requires the NameServer address the endpoint requires`), which reports `promise resolved "{ connected: true, …(6) }" instead of rejecting`. ### What Did You Expect to See? The mock rejects a blank address the same way the endpoint does - `namesrvAddr is required` - and a non-blank address keeps answering the demo probe. ### What Did You See Instead? The mock answers `connected: true` with an empty `namesrvAddr`, so demo mode reports a successful connection to an address the real endpoint rejects with 400. ### Additional Context This is the same mock/endpoint parity rule the neighbouring changes apply (#6146 rejects the pagination values the DLQ/topic endpoints refuse, #5486 enforces the mock cluster-config rejection). A fix with a regression test follows in a pull request. ### Are You Willing to Submit a Pull Request? - [x] Yes, I am willing to submit a pull request. -- 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]
