hachikuji commented on a change in pull request #9349: URL: https://github.com/apache/kafka/pull/9349#discussion_r497681395
########## File path: clients/src/test/java/org/apache/kafka/clients/consumer/KafkaConsumerTest.java ########## @@ -1994,6 +1995,24 @@ public void testGetGroupMetadata() { assertEquals(groupInstanceId, groupMetadataAfterPoll.groupInstanceId()); } + @Test + public void testInvalidGroupMetadata() { + Properties props = new Properties(); + props.setProperty(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9999"); + props.setProperty(ConsumerConfig.METRIC_REPORTER_CLASSES_CONFIG, MockMetricsReporter.class.getName()); + KafkaConsumer<String, String> consumer = new KafkaConsumer<>( + props, new StringDeserializer(), new StringDeserializer()); + + // concurrent access is illegal + consumer.currentThread.set(123); Review comment: Another way to test this might be to use `MockClient.enableBlockingUntilWakeup`. That would let us block in `Consumer.poll`. ---------------------------------------------------------------- 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