chia7712 commented on code in PR #23378:
URL: https://github.com/apache/kafka/pull/23378#discussion_r4049166411


##########
tools/src/test/java/org/apache/kafka/tools/consumer/group/ListConsumerGroupTest.java:
##########
@@ -94,47 +89,43 @@ private List<GroupProtocol> supportedGroupProtocols() {
 
     @ClusterTest
     public void testListConsumerGroupsWithoutFilters() throws Exception {
-        for (int i = 0; i < supportedGroupProtocols().size(); i++) {
-            GroupProtocol groupProtocol = supportedGroupProtocols().get(i);
+        List<GroupProtocol> groupProtocols = supportedGroupProtocols();
+        for (int i = 0; i < groupProtocols.size(); i++) {
+            GroupProtocol groupProtocol = groupProtocols.get(i);
             String topic = TOPIC_PREFIX + groupProtocol.name;
             String protocolGroup = PROTOCOL_GROUP_PREFIX + groupProtocol.name;
             String topicGroup = TOPIC_GROUP_PREFIX + i;
             String topicPartitionsGroup = TOPIC_PARTITIONS_GROUP_PREFIX + i;
-            createTopic(topic);
+            clusterInstance.createTopic(topic, 1, (short) 1);
 
             try (AutoCloseable topicPartitionsConsumerGroupExecutor = 
consumerGroupClosable(topicPartitionsGroup, Set.of(new TopicPartition(topic, 
0)));
                  AutoCloseable topicConsumerGroupExecutor = 
consumerGroupClosable(GroupProtocol.CLASSIC, topicGroup, topic);
                  AutoCloseable protocolConsumerGroupExecutor = 
consumerGroupClosable(groupProtocol, protocolGroup, topic);
                  ConsumerGroupCommand.ConsumerGroupService service = 
getConsumerGroupService(new String[]{"--bootstrap-server", 
clusterInstance.bootstrapServers(), "--list"})
             ) {
-                Set<String> expectedGroups = set(List.of(topicPartitionsGroup, 
topicGroup, protocolGroup));
-                final AtomicReference<Set> foundGroups = new 
AtomicReference<>();
+                Set<String> expectedGroups = Set.of(topicPartitionsGroup, 
topicGroup, protocolGroup);
+                final AtomicReference<Set<String>> foundGroups = new 
AtomicReference<>();
 
                 TestUtils.waitForCondition(() -> {
-                    foundGroups.set(set(service.listConsumerGroups()));
+                    foundGroups.set(new 
HashSet<>(service.listConsumerGroups()));

Review Comment:
   `Set.copyOf`



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