Copilot commented on code in PR #785:
URL: 
https://github.com/apache/rocketmq-dashboard/pull/785#discussion_r3701643380


##########
server/src/test/java/org/apache/rocketmq/studio/cluster/broker/ClusterServiceTest.java:
##########
@@ -348,7 +348,19 @@ void restartBrokerShouldThrowWhenBrokerNotFound() {
     }
 
     @Test
-    void nameServerOperationsShouldAcceptExistingNameServer() {
+    void createNameServerShouldThrowUnsupportedWhenClusterExists() {
+        
when(clusterRepository.findById("cluster-1")).thenReturn(Optional.of(sampleCluster));
+        CreateNameServerDTO command = CreateNameServerDTO.builder()
+                .clusterId("cluster-1")
+                .addr("10.0.0.21:9876")
+                .build();
+
+        assertUnsupportedOperation(() -> 
clusterService.createNameServer(command),
+                "NameServer create is not implemented");
+    }

Review Comment:
   The PR description calls out preserving existing 404 behavior for missing 
clusters, but there is no unit test covering `createNameServer` when the 
cluster does not exist. Adding it would guard against accidental regression 
(e.g., throwing 501 before the existence check).



##########
server/src/main/java/org/apache/rocketmq/studio/cluster/broker/ClusterService.java:
##########
@@ -200,4 +189,8 @@ private void requireProxy(ClusterVO cluster, String addr) {
             throw new BusinessException(404, "Proxy not found: " + addr);
         }
     }
+
+    private BusinessException unsupportedOperation(String operation) {
+        return new BusinessException(501, operation + " is not implemented by 
the current cluster provider");
+    }

Review Comment:
   `unsupportedOperation` currently only constructs a 501 exception, but 
(unlike other *ProviderStub classes) it doesn't emit any warning log indicating 
that an unsupported runtime operation was requested. This can make it harder to 
diagnose why an operation returns 501 in production logs.



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