TaiJuWu commented on code in PR #19329:
URL: https://github.com/apache/kafka/pull/19329#discussion_r2471558258


##########
clients/clients-integration-tests/src/test/java/org/apache/kafka/clients/consumer/ShareConsumerTest.java:
##########
@@ -2057,6 +2058,57 @@ public void testComplexShareConsumer() throws Exception {
         verifyShareGroupStateTopicRecordsProduced();
     }
 
+    @ClusterTest(
+        brokers = 1,
+        serverProperties = {
+            @ClusterConfigProperty(key = "auto.create.topics.enable", value = 
"false"),
+            @ClusterConfigProperty(key = 
"group.coordinator.rebalance.protocols", value = "classic,consumer,share"),
+            @ClusterConfigProperty(key = "group.share.enable", value = "true"),
+            @ClusterConfigProperty(key = 
"group.share.partition.max.record.locks", value = "10000"),
+            @ClusterConfigProperty(key = 
"group.share.record.lock.duration.ms", value = "15000"),
+            @ClusterConfigProperty(key = "offsets.topic.replication.factor", 
value = "1"),
+            @ClusterConfigProperty(key = 
"share.coordinator.state.topic.min.isr", value = "1"),
+            @ClusterConfigProperty(key = 
"share.coordinator.state.topic.num.partitions", value = "3"),
+            @ClusterConfigProperty(key = 
"share.coordinator.state.topic.replication.factor", value = "1"),
+            @ClusterConfigProperty(key = "transaction.state.log.min.isr", 
value = "1"),
+            @ClusterConfigProperty(key = 
"transaction.state.log.replication.factor", value = "1"),
+            @ClusterConfigProperty(key = "group.share.max.size", value = "3") 
// Setting max group size to 3
+        }
+    )
+    public void testShareGroupMaxSizeConfigExceeded() throws Exception {
+        // creating 3 consumers in the group1
+        ShareConsumer<byte[], byte[]> shareConsumer1 = 
createShareConsumer("group1");
+        ShareConsumer<byte[], byte[]> shareConsumer2 = 
createShareConsumer("group1");
+        ShareConsumer<byte[], byte[]> shareConsumer3 = 
createShareConsumer("group1");
+
+        shareConsumer1.subscribe(Set.of(tp.topic()));
+        shareConsumer2.subscribe(Set.of(tp.topic()));
+        shareConsumer3.subscribe(Set.of(tp.topic()));
+
+        shareConsumer1.poll(Duration.ofMillis(5000));
+        shareConsumer2.poll(Duration.ofMillis(5000));
+        shareConsumer3.poll(Duration.ofMillis(5000));
+

Review Comment:
   Sorry for late review, should we make sure shareConsumer is in group here?
   
   for example:
   ```
   try (var admin = cluster.admin()) {
       TestUtils.waitForCondition(() -> {
           DescribeShareGroupsResult result = 
admin.describeShareGroups(List.of("group1"));
           return result.all().get().get("group1").members().size() == 3;
       }, 30000, 200L, () -> "The number of share consumer should be 3.");
   }
   ```



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