philipnee commented on code in PR #16043: URL: https://github.com/apache/kafka/pull/16043#discussion_r1631236747
########## core/src/test/scala/integration/kafka/api/PlaintextConsumerTest.scala: ########## @@ -189,6 +189,20 @@ class PlaintextConsumerTest extends BaseConsumerTest { assertThrows(classOf[InvalidTopicException], () => consumer.partitionsFor(";3# ads,{234")) } + @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumAndGroupProtocolNames) + @MethodSource(Array("getTestQuorumAndGroupProtocolParametersAll")) + def testSubscribeInvalidTopic(quorum: String, groupProtocol: String): Unit = { + val invalidTopicName = "topic abc" + val consumer = createConsumer() + + // subscribe invalid topic + consumer.subscribe(List(invalidTopicName).asJava) + + consumer.poll(Duration.ZERO); Review Comment: if you look at the log, you can see the client poll the background event queue before receiving the metadata error as you poll immediately after subscribe, whereas the old consumer would keep polling the network client during the long poll (the second poll). you can try to use `waitUntilTrue` to check if the exception is thrown in the end. -- 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