[ISSUE #788] Return unavailable for Ops setting writes - #789
Closed
Aias00 wants to merge 1 commit into
Closed
Conversation
There was a problem hiding this comment.
Pull request overview
This PR prevents the Ops page write endpoints from reporting success when the backend does not actually apply NameServer/VIP/TLS settings to the real RocketMQ admin configuration path, by making those write operations explicitly fail with HTTP 501.
Changes:
- Update
OpsServicewrite operations (NameServer add/update/delete, VIP toggle, TLS toggle) to throw aBusinessException(501, ...)after basic request validation. - Update service tests to assert the new “unavailable” behavior and that read-only home page values remain unchanged.
- Add a controller test asserting that a
BusinessException(501, ...)is mapped to HTTP 501 + error payload for the update NameServer endpoint.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| server/src/main/java/org/apache/rocketmq/studio/ops/OpsService.java | Makes Ops write methods validate input then fail fast with a consistent 501 “unavailable” error. |
| server/src/test/java/org/apache/rocketmq/studio/ops/OpsServiceTest.java | Updates unit tests to verify write methods now return 501 and do not mutate read-only Ops home state. |
| server/src/test/java/org/apache/rocketmq/studio/ops/OpsControllerTest.java | Adds controller-level coverage that a service-side 501 BusinessException maps to HTTP 501 and correct JSON body. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+86
to
+90
| @Test | ||
| void updateNameSvrAddrShouldReturnUnavailableWhenServiceRejects() throws Exception { | ||
| doThrow(new BusinessException(501, "Ops settings are not connected to the cluster admin configuration")) | ||
| .when(opsService).updateNameServer("10.0.0.1:9876"); | ||
|
|
Author
|
Superseded by consolidated PR #938, which contains this change and has passing checks. Closing this narrower PR to keep review focused. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which Issue(s) This PR Fixes
Fixes #788
Brief Description
The Ops page exposes NameServer, VIP channel, and TLS write operations, but the current service only updates process-local fields and does not apply those settings to the real RocketMQ AdminClient/configuration path.
This PR keeps the read-only Ops home data available, but changes write operations to fail explicitly with HTTP 501 until they are wired to the real cluster admin configuration flow. This avoids showing users a successful applied change when no runtime MQAdmin setting was changed.
Covered write operations:
How Did You Test This Change?
JAVA_HOME=/Users/aias/Library/Java/JavaVirtualMachines/openjdk-21.0.2/Contents/Home mvn -Dtest=OpsServiceTest,OpsControllerTest test