feyman2016 commented on a change in pull request #8589:
URL: https://github.com/apache/kafka/pull/8589#discussion_r428587018



##########
File path: 
core/src/test/scala/integration/kafka/api/PlaintextAdminIntegrationTest.scala
##########
@@ -1017,47 +1017,71 @@ class PlaintextAdminIntegrationTest extends 
BaseAdminIntegrationTest {
       assertTrue(0 == list1.errors().get().size())
       assertTrue(0 == list1.valid().get().size())
       val testTopicName = "test_topic"
+      val testTopicName1 = testTopicName + "1"
+      val testTopicName2 = testTopicName + "2"
       val testNumPartitions = 2
-      client.createTopics(Collections.singleton(
-        new NewTopic(testTopicName, testNumPartitions, 1.toShort))).all().get()
-      waitForTopics(client, List(testTopicName), List())
+
+      client.createTopics(util.Arrays.asList(new NewTopic(testTopicName, 
testNumPartitions, 1.toShort),
+        new NewTopic(testTopicName1, testNumPartitions, 1.toShort),
+        new NewTopic(testTopicName2, testNumPartitions, 1.toShort)
+      )).all().get()
+      waitForTopics(client, List(testTopicName, testTopicName1, 
testTopicName2), List())
 
       val producer = createProducer()
       try {
         producer.send(new ProducerRecord(testTopicName, 0, null, null)).get()
       } finally {
         Utils.closeQuietly(producer, "producer")
       }
+
+      val EMPTY_GROUP_INSTANCE_ID = ""
       val testGroupId = "test_group_id"
       val testClientId = "test_client_id"
       val testInstanceId = "test_instance_id"
+      val testInstanceId1 = testInstanceId + "1"
       val fakeGroupId = "fake_group_id"
-      val newConsumerConfig = new Properties(consumerConfig)
-      newConsumerConfig.setProperty(ConsumerConfig.GROUP_ID_CONFIG, 
testGroupId)
-      newConsumerConfig.setProperty(ConsumerConfig.CLIENT_ID_CONFIG, 
testClientId)
-      newConsumerConfig.setProperty(ConsumerConfig.GROUP_INSTANCE_ID_CONFIG, 
testInstanceId)
-      val consumer = createConsumer(configOverrides = newConsumerConfig)
-      val latch = new CountDownLatch(1)
+
+
+      def createConsumerByGroupInstanceId(groupInstanceId: String) = {
+        val newConsumerConfig = new Properties(consumerConfig)
+        newConsumerConfig.setProperty(ConsumerConfig.GROUP_ID_CONFIG, 
testGroupId)
+        newConsumerConfig.setProperty(ConsumerConfig.CLIENT_ID_CONFIG, 
testClientId)
+        if (groupInstanceId != EMPTY_GROUP_INSTANCE_ID ) {
+          
newConsumerConfig.setProperty(ConsumerConfig.GROUP_INSTANCE_ID_CONFIG, 
groupInstanceId)
+        }
+        createConsumer(configOverrides = newConsumerConfig)
+      }
+
+      // contains two static members and one dynamic member
+      val groupInstanceSet = Set(testInstanceId, testInstanceId1, 
EMPTY_GROUP_INSTANCE_ID)
+      val consumerSet = 
groupInstanceSet.map(createConsumerByGroupInstanceId(_))
+      val topicSet = Set(testTopicName, testTopicName1, testTopicName2)
+
+      val latch = new CountDownLatch(consumerSet.size)
       try {
-        // Start a consumer in a thread that will subscribe to a new group.
-        val consumerThread = new Thread {
-          override def run : Unit = {
-            consumer.subscribe(Collections.singleton(testTopicName))
-
-            try {
-              while (true) {
-                consumer.poll(JDuration.ofSeconds(5))
-                if (!consumer.assignment.isEmpty && latch.getCount > 0L)
-                  latch.countDown()
-                consumer.commitSync()
+        def createConsumerThread[K,V](consumer: KafkaConsumer[K,V], topic: 
String): Thread = {
+          new Thread {
+            override def run : Unit = {
+              consumer.subscribe(Collections.singleton(topic))
+              try {
+                while (true) {
+                  consumer.poll(JDuration.ofSeconds(5))
+                  if ( !consumer.assignment.isEmpty && latch.getCount > 0L)

Review comment:
       Fixed




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

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


Reply via email to