lianetm commented on code in PR #18668: URL: https://github.com/apache/kafka/pull/18668#discussion_r1927561893
########## core/src/test/scala/integration/kafka/api/SaslClientsWithInvalidCredentialsTest.scala: ########## @@ -222,6 +222,18 @@ class SaslClientsWithInvalidCredentialsTest extends AbstractSaslTest { }, s"Operation did not succeed within timeout after $attempts") } + private def verifyWithRetryPredicate(predicate: => Boolean): Unit = { + var attempts = 0 + TestUtils.waitUntilTrue(() => { + try { + attempts += 1 + predicate + } catch { + case _: SaslAuthenticationException => false + } + }, s"Operation did not succeed within timeout after $attempts") + } Review Comment: interesting, makes sense to me. But then, couldn't we just change the ``` verifyWithRetry(assertEquals(1, consumer.poll(Duration.ofMillis(1000)).count)) ``` to ``` verifyWithRetry(consumer.poll(Duration.ofMillis(1000)).count == 1) ``` (just to avoid introducing this new `verifyWithRetryPredicate`) -- 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