divijvaidya commented on code in PR #12590: URL: https://github.com/apache/kafka/pull/12590#discussion_r1057619747
########## clients/src/test/java/org/apache/kafka/clients/consumer/KafkaConsumerTest.java: ########## @@ -1539,30 +1543,30 @@ public void testOffsetOfPausedPartitions() { client.requests().clear(); consumer.unsubscribe(); - consumer.close(); + consumer.close(Duration.ZERO); } @Test public void testPollWithNoSubscription() { - try (KafkaConsumer<byte[], byte[]> consumer = newConsumer((String) null)) { - assertThrows(IllegalStateException.class, () -> consumer.poll(Duration.ZERO)); - } + KafkaConsumer<byte[], byte[]> consumer = newConsumer((String) null); + assertThrows(IllegalStateException.class, () -> consumer.poll(Duration.ZERO)); + consumer.close(Duration.ZERO); } @Test public void testPollWithEmptySubscription() { - try (KafkaConsumer<byte[], byte[]> consumer = newConsumer(groupId)) { - consumer.subscribe(Collections.emptyList()); - assertThrows(IllegalStateException.class, () -> consumer.poll(Duration.ZERO)); - } + KafkaConsumer<byte[], byte[]> consumer = newConsumer(groupId); + consumer.subscribe(Collections.emptyList()); + assertThrows(IllegalStateException.class, () -> consumer.poll(Duration.ZERO)); + consumer.close(Duration.ZERO); } @Test public void testPollWithEmptyUserAssignment() { - try (KafkaConsumer<byte[], byte[]> consumer = newConsumer(groupId)) { Review Comment: yes. try-with-resources is calling `KafkaConsumer.close()` which has a timeout set to 30s. These tests will wait for default timeout to exit (close() in the tests is expected to be unsuccessful because there is no server to send the request to) and hence, unnecessarily, increase the execution time of these tests. -- 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