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


##########
core/src/test/java/kafka/test/ClusterTestExtensionsTest.java:
##########
@@ -108,12 +117,12 @@ public void testClusterTests() {
     }
 
     @ClusterTests({
-        @ClusterTest(clusterType = Type.ZK),
-        @ClusterTest(clusterType = Type.ZK, disksPerBroker = 2),
-        @ClusterTest(clusterType = Type.KRAFT),
-        @ClusterTest(clusterType = Type.KRAFT, disksPerBroker = 2),
-        @ClusterTest(clusterType = Type.CO_KRAFT),
-        @ClusterTest(clusterType = Type.CO_KRAFT, disksPerBroker = 2)
+            @ClusterTest(clusterType = Type.ZK),

Review Comment:
   ditto



##########
core/src/test/java/kafka/test/ClusterTestExtensionsTest.java:
##########
@@ -70,28 +79,28 @@ public void testClusterTest(ClusterInstance 
clusterInstance) {
     @ClusterTemplate("generate1")
     public void testClusterTemplate() {
         Assertions.assertEquals(ClusterInstance.ClusterType.ZK, 
clusterInstance.clusterType(),
-            "generate1 provided a Zk cluster, so we should see that here");
+                "generate1 provided a Zk cluster, so we should see that here");

Review Comment:
   ditto



##########
tools/src/test/java/org/apache/kafka/tools/consumer/group/ConsumerGroupExecutor.java:
##########
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.kafka.tools.consumer.group;
+
+import org.apache.kafka.clients.consumer.KafkaConsumer;
+import org.apache.kafka.common.errors.WakeupException;
+import org.apache.kafka.common.utils.Utils;
+
+import java.time.Duration;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.function.Supplier;
+
+import static java.util.Collections.singleton;
+
+class ConsumerGroupExecutor {

Review Comment:
   Other tests (for example: #15872) need both this and `generator`. How about 
renaming this to `ConsumerGroupCommandTestUtils` and move the implementation of 
`generator` to it?



##########
core/src/test/java/kafka/test/ClusterTestExtensionsTest.java:
##########
@@ -135,4 +144,49 @@ public void testNoAutoStart() {
     public void testDefaults(ClusterInstance clusterInstance) {
         Assertions.assertEquals(MetadataVersion.IBP_3_8_IV0, 
clusterInstance.config().metadataVersion());
     }
+
+    @ClusterTests({
+            @ClusterTest(name = "enable-new-coordinator", clusterType = 
Type.ALL, serverProperties = {
+                    @ClusterConfigProperty(key = 
NEW_GROUP_COORDINATOR_ENABLE_CONFIG, value = "true"),
+            }),
+            @ClusterTest(name = "enable-new-consumer-rebalance-coordinator", 
clusterType = Type.ALL, serverProperties = {
+                    @ClusterConfigProperty(key = 
GROUP_COORDINATOR_REBALANCE_PROTOCOLS_CONFIG, value = "classic,consumer"),
+            }),
+            @ClusterTest(name = 
"enable-new-coordinator-and-new-consumer-rebalance-coordinator", clusterType = 
Type.ALL, serverProperties = {
+                    @ClusterConfigProperty(key = 
NEW_GROUP_COORDINATOR_ENABLE_CONFIG, value = "true"),
+                    @ClusterConfigProperty(key = 
GROUP_COORDINATOR_REBALANCE_PROTOCOLS_CONFIG, value = "classic,consumer"),
+            }),
+            @ClusterTest(name = 
"enable-new-coordinator-and-disable-new-consumer-rebalance-coordinator", 
clusterType = Type.ALL, serverProperties = {
+                    @ClusterConfigProperty(key = 
NEW_GROUP_COORDINATOR_ENABLE_CONFIG, value = "true"),
+                    @ClusterConfigProperty(key = 
GROUP_COORDINATOR_REBALANCE_PROTOCOLS_CONFIG, value = "classic"),
+            }),
+            @ClusterTest(name = 
"disable-new-coordinator-and-enable-new-consumer-rebalance-coordinator", 
clusterType = Type.ALL, serverProperties = {
+                    @ClusterConfigProperty(key = 
NEW_GROUP_COORDINATOR_ENABLE_CONFIG, value = "false"),
+                    @ClusterConfigProperty(key = 
GROUP_COORDINATOR_REBALANCE_PROTOCOLS_CONFIG, value = "classic,consumer"),
+            }),
+    })
+    public void testSupportedNewGroupProtocols(ClusterInstance 
clusterInstance) {
+        Set<GroupProtocol> supportedGroupProtocols = new HashSet<>();
+        supportedGroupProtocols.add(CLASSIC);
+        supportedGroupProtocols.add(CONSUMER);
+        
Assertions.assertTrue(clusterInstance.supportedGroupProtocols().containsAll(supportedGroupProtocols));
+        
Assertions.assertEquals(clusterInstance.supportedGroupProtocols().size(), 2);
+    }
+
+    @ClusterTests({
+            @ClusterTest(name = "disable-new-coordinator", clusterType = 
Type.ALL, serverProperties = {
+                    @ClusterConfigProperty(key = 
NEW_GROUP_COORDINATOR_ENABLE_CONFIG, value = "false"),
+            }),
+            @ClusterTest(name = "disable-new-consumer-rebalance-coordinator", 
clusterType = Type.ALL, serverProperties = {
+                    @ClusterConfigProperty(key = 
GROUP_COORDINATOR_REBALANCE_PROTOCOLS_CONFIG, value = "classic"),
+            }),
+            @ClusterTest(name = 
"disable-new-coordinator-and-disable-new-consumer-rebalance-coordinator", 
clusterType = Type.ALL, serverProperties = {
+                    @ClusterConfigProperty(key = 
NEW_GROUP_COORDINATOR_ENABLE_CONFIG, value = "false"),
+                    @ClusterConfigProperty(key = 
GROUP_COORDINATOR_REBALANCE_PROTOCOLS_CONFIG, value = "classic"),
+            }),
+    })
+    public void testNotSupportedNewGroupProtocols(ClusterInstance 
clusterInstance) {
+        
Assertions.assertTrue(clusterInstance.supportedGroupProtocols().contains(CLASSIC));
+        
Assertions.assertEquals(clusterInstance.supportedGroupProtocols().size(), 1);

Review Comment:
   the first argument is "expected" value, so it should be 
`Assertions.assertEquals(1, clusterInstance.supportedGroupProtocols().size());`



##########
core/src/test/java/kafka/test/ClusterTestExtensionsTest.java:
##########
@@ -70,28 +79,28 @@ public void testClusterTest(ClusterInstance 
clusterInstance) {
     @ClusterTemplate("generate1")
     public void testClusterTemplate() {
         Assertions.assertEquals(ClusterInstance.ClusterType.ZK, 
clusterInstance.clusterType(),
-            "generate1 provided a Zk cluster, so we should see that here");
+                "generate1 provided a Zk cluster, so we should see that here");
         Assertions.assertEquals("Generated Test", 
clusterInstance.config().name().orElse(""),
-            "generate1 named this cluster config, so we should see that here");
+                "generate1 named this cluster config, so we should see that 
here");
         Assertions.assertEquals("bar", 
clusterInstance.config().serverProperties().get("foo"));
     }
 
     // Multiple @ClusterTest can be used with @ClusterTests
     @ClusterTests({
-        @ClusterTest(name = "cluster-tests-1", clusterType = Type.ZK, 
serverProperties = {
-            @ClusterConfigProperty(key = "foo", value = "bar"),
-            @ClusterConfigProperty(key = "spam", value = "eggs")
-        }),
-        @ClusterTest(name = "cluster-tests-2", clusterType = Type.KRAFT, 
serverProperties = {
-            @ClusterConfigProperty(key = "foo", value = "baz"),
-            @ClusterConfigProperty(key = "spam", value = "eggz"),
-            @ClusterConfigProperty(key = "default.key", value = 
"overwrite.value")
-        }),
-        @ClusterTest(name = "cluster-tests-3", clusterType = Type.CO_KRAFT, 
serverProperties = {
-            @ClusterConfigProperty(key = "foo", value = "baz"),
-            @ClusterConfigProperty(key = "spam", value = "eggz"),
-            @ClusterConfigProperty(key = "default.key", value = 
"overwrite.value")
-        })
+            @ClusterTest(name = "cluster-tests-1", clusterType = Type.ZK, 
serverProperties = {
+                    @ClusterConfigProperty(key = "foo", value = "bar"),
+                    @ClusterConfigProperty(key = "spam", value = "eggs")

Review Comment:
   ditto



##########
core/src/test/java/kafka/test/ClusterTestExtensionsTest.java:
##########
@@ -27,17 +27,26 @@
 import kafka.test.junit.ClusterTestExtensions;
 import org.apache.kafka.clients.admin.Admin;
 import org.apache.kafka.clients.admin.DescribeLogDirsResult;
+import org.apache.kafka.clients.consumer.GroupProtocol;
 import org.apache.kafka.server.common.MetadataVersion;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.extension.ExtendWith;
 
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Map;
+import java.util.Set;
 import java.util.concurrent.ExecutionException;
 
 
+import static org.apache.kafka.clients.consumer.GroupProtocol.CLASSIC;
+import static org.apache.kafka.clients.consumer.GroupProtocol.CONSUMER;
+import static 
org.apache.kafka.coordinator.group.GroupCoordinatorConfig.GROUP_COORDINATOR_REBALANCE_PROTOCOLS_CONFIG;
+import static 
org.apache.kafka.coordinator.group.GroupCoordinatorConfig.NEW_GROUP_COORDINATOR_ENABLE_CONFIG;
+
+
 @ClusterTestDefaults(clusterType = Type.ZK, serverProperties = {
-    @ClusterConfigProperty(key = "default.key", value = "default.value"),
+        @ClusterConfigProperty(key = "default.key", value = "default.value"),

Review Comment:
   Please revert the unrelated changes.



##########
core/src/test/java/kafka/test/ClusterTestExtensionsTest.java:
##########
@@ -70,28 +79,28 @@ public void testClusterTest(ClusterInstance 
clusterInstance) {
     @ClusterTemplate("generate1")
     public void testClusterTemplate() {
         Assertions.assertEquals(ClusterInstance.ClusterType.ZK, 
clusterInstance.clusterType(),
-            "generate1 provided a Zk cluster, so we should see that here");
+                "generate1 provided a Zk cluster, so we should see that here");
         Assertions.assertEquals("Generated Test", 
clusterInstance.config().name().orElse(""),
-            "generate1 named this cluster config, so we should see that here");
+                "generate1 named this cluster config, so we should see that 
here");

Review Comment:
   ditto



-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to