Copilot commented on code in PR #10773:
URL: https://github.com/apache/rocketmq/pull/10773#discussion_r3701852275
##########
proxy/src/test/java/org/apache/rocketmq/proxy/service/admin/DefaultAdminServiceTest.java:
##########
@@ -87,6 +88,29 @@ public void testCreateTopic() throws Exception {
assertEquals(8,
topicConfigArgumentCaptor.getValue().getReadQueueNums());
}
+ @Test
+ public void testCreateTopicOnBrokerSkipsMalformedCurrentBrokerData()
throws Exception {
+ BrokerData malformedBrokerData = new BrokerData();
+
+ ArgumentCaptor<String> addrArgumentCaptor =
ArgumentCaptor.forClass(String.class);
+ ArgumentCaptor<TopicConfig> topicConfigArgumentCaptor =
ArgumentCaptor.forClass(TopicConfig.class);
+ doNothing().when(mqClientAPIExt)
+ .createTopic(addrArgumentCaptor.capture(), anyString(),
topicConfigArgumentCaptor.capture(), anyLong());
+
+ assertTrue(defaultAdminService.createTopicOnBroker(
+ "createTopic",
+ 7,
+ 8,
+ Collections.singletonList(malformedBrokerData),
+ createTopicRouteData(1).getBrokerDatas(),
+ false,
+ 0
+ ));
+
+ assertEquals("127.0.0.1:10911", addrArgumentCaptor.getValue());
+ assertEquals("createTopic",
topicConfigArgumentCaptor.getValue().getTopicName());
+ }
Review Comment:
The test only asserts the last captured broker address via `getValue()`,
which won’t detect accidental extra `createTopic` invocations (e.g., duplicate
calls). For consistency with `testCreateTopic` and to make the regression more
robust, assert the number of captured addresses and check the first/only value
explicitly.
--
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]