philipnee commented on code in PR #16043:
URL: https://github.com/apache/kafka/pull/16043#discussion_r1631326145


##########
core/src/test/scala/integration/kafka/api/PlaintextConsumerTest.scala:
##########
@@ -192,15 +192,22 @@ class PlaintextConsumerTest extends BaseConsumerTest {
   @ParameterizedTest(name = 
TestInfoUtils.TestWithParameterizedQuorumAndGroupProtocolNames)
   @MethodSource(Array("getTestQuorumAndGroupProtocolParametersAll"))
   def testSubscribeInvalidTopic(quorum: String, groupProtocol: String): Unit = 
{
-    val invalidTopicName = "topic abc"
+    val invalidTopicName = "topic abc"  // Invalid topic name due to space
     val consumer = createConsumer()
 
     // subscribe invalid topic
     consumer.subscribe(List(invalidTopicName).asJava)
 
-    consumer.poll(Duration.ZERO);
-    val exception = assertThrows(classOf[InvalidTopicException], () => 
consumer.poll(Duration.ofMillis(5000)))
-    assertEquals(String.format("Invalid topics: [%s]", invalidTopicName), 
exception.getMessage)
+    var exception : Exception = null
+    TestUtils.waitUntilTrue(() => {
+      try consumer.poll(Duration.ofMillis(500)) catch {
+        case e : Exception => exception = e
+      }
+      exception != null
+    }, waitTimeMs = 5000, msg = "An exception should be thrown.")

Review Comment:
   let's be explicit about InvalidTopicException in the message part.



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