soarez commented on code in PR #14903: URL: https://github.com/apache/kafka/pull/14903#discussion_r1529927411
########## core/src/test/scala/unit/kafka/server/BrokerLifecycleManagerTest.scala: ########## @@ -197,11 +197,17 @@ class BrokerLifecycleManagerTest { result } - def poll[T](context: RegistrationTestContext, manager: BrokerLifecycleManager, future: Future[T]): T = { - while (!future.isDone || context.mockClient.hasInFlightRequests) { - context.poll() + def poll[T](ctx: RegistrationTestContext, manager: BrokerLifecycleManager, future: Future[T]): T = { + while (ctx.mockChannelManager.unsentQueue.isEmpty) { + // If the manager is idling until scheduled events we need to advance the clock + if (manager.eventQueue.scheduledAfterIdling() + .filter(!_.getClass.getSimpleName.endsWith("TimeoutEvent")) // avoid triggering timeout events Review Comment: This is a bit ugly. It only applies to `RegistrationTimeoutEvent`. We want to avoid triggering those deferred events. Instead of checking for that class specifically, I thought there may be other timeout event types in the future and we'll also want to avoid those. I also ruled out extending EventQueue.Event as we only care about this in this test suite. I feel ambivalent about the approach I've taken here, so please let me know if you have a preference. -- 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