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


##########
tools/src/test/java/org/apache/kafka/tools/consumer/group/DeleteOffsetsConsumerGroupCommandIntegrationTest.java:
##########
@@ -171,29 +209,27 @@ private void produceRecord() {
     }
 
     private void withStableConsumerGroup(Runnable body) {
-        Consumer<byte[], byte[]> consumer = createConsumer(new Properties());
-        try {
-            TestUtils.subscribeAndWaitForRecords(TOPIC, consumer, 
DEFAULT_MAX_WAIT_MS);
+        try (Consumer<byte[], byte[]> consumer = createConsumer(new 
Properties());) {

Review Comment:
   please remove `;` 



##########
tools/src/test/java/org/apache/kafka/tools/consumer/group/DeleteOffsetsConsumerGroupCommandIntegrationTest.java:
##########
@@ -202,7 +238,7 @@ private KafkaProducer<byte[], byte[]> 
createProducer(Properties config) {
     }
 
     private Consumer<byte[], byte[]> createConsumer(Properties config) {

Review Comment:
   Could you add tests for `GroupProtocol.CONSUMER`? see comment: 
https://github.com/apache/kafka/pull/15766#discussion_r1576009920



##########
tools/src/test/java/org/apache/kafka/tools/consumer/group/DeleteOffsetsConsumerGroupCommandIntegrationTest.java:
##########
@@ -171,29 +209,27 @@ private void produceRecord() {
     }
 
     private void withStableConsumerGroup(Runnable body) {
-        Consumer<byte[], byte[]> consumer = createConsumer(new Properties());
-        try {
-            TestUtils.subscribeAndWaitForRecords(TOPIC, consumer, 
DEFAULT_MAX_WAIT_MS);
+        try (Consumer<byte[], byte[]> consumer = createConsumer(new 
Properties());) {
+            consumer.subscribe(Collections.singletonList(TOPIC));
+            ConsumerRecords<byte[], byte[]> records = 
consumer.poll(Duration.ofMillis(DEFAULT_MAX_WAIT_MS));
+            Assertions.assertNotEquals(0, records.count());
             consumer.commitSync();
             body.run();
-        } finally {
-            Utils.closeQuietly(consumer, "consumer");
         }
     }
 
     private void withEmptyConsumerGroup(Runnable body) {

Review Comment:
   Can we merge `withStableConsumerGroup` and `withEmptyConsumerGroup`?



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