[GitHub] [kafka] dajac commented on a change in pull request #10243: KAFKA-12398: Fix flaky test `ConsumerBounceTest.testClose`
dajac commented on a change in pull request #10243: URL: https://github.com/apache/kafka/pull/10243#discussion_r593505670 ## File path: core/src/test/scala/integration/kafka/api/ConsumerBounceTest.scala ## @@ -476,14 +476,18 @@ class ConsumerBounceTest extends AbstractConsumerTest with Logging { // New instance of consumer should be assigned partitions immediately and should see committed offsets. val assignSemaphore = new Semaphore(0) val consumer = createConsumerWithGroupId(groupId) -consumer.subscribe(Collections.singletonList(topic), new ConsumerRebalanceListener { +consumer.subscribe(Collections.singletonList(topic), new ConsumerRebalanceListener { def onPartitionsAssigned(partitions: Collection[TopicPartition]): Unit = { assignSemaphore.release() } def onPartitionsRevoked(partitions: Collection[TopicPartition]): Unit = { }}) -consumer.poll(time.Duration.ofSeconds(3L)) -assertTrue(assignSemaphore.tryAcquire(1, TimeUnit.SECONDS), "Assignment did not complete on time") + +TestUtils.waitUntilTrue(() => { + consumer.poll(time.Duration.ZERO) Review comment: Should we keep a small poll timeout here? Something like 100ms? 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
[GitHub] [kafka] dajac commented on a change in pull request #10243: KAFKA-12398: Fix flaky test `ConsumerBounceTest.testClose`
dajac commented on a change in pull request #10243: URL: https://github.com/apache/kafka/pull/10243#discussion_r587215193 ## File path: core/src/test/scala/integration/kafka/api/ConsumerBounceTest.scala ## @@ -483,7 +483,8 @@ class ConsumerBounceTest extends AbstractConsumerTest with Logging { def onPartitionsRevoked(partitions: Collection[TopicPartition]): Unit = { }}) consumer.poll(time.Duration.ofSeconds(3L)) -assertTrue(assignSemaphore.tryAcquire(1, TimeUnit.SECONDS), "Assignment did not complete on time") +TestUtils.waitUntilTrue(() => assignSemaphore.tryAcquire(100, TimeUnit.MILLISECONDS), + "Assignment did not complete on time") Review comment: Make sense. So, if `assignSemaphore` is not released after `poll` is executed, it will never be released, right? Should we include `poll` within `waitUntilTrue`? 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
[GitHub] [kafka] dajac commented on a change in pull request #10243: KAFKA-12398: Fix flaky test `ConsumerBounceTest.testClose`
dajac commented on a change in pull request #10243: URL: https://github.com/apache/kafka/pull/10243#discussion_r585387234 ## File path: core/src/test/scala/integration/kafka/api/ConsumerBounceTest.scala ## @@ -483,7 +483,8 @@ class ConsumerBounceTest extends AbstractConsumerTest with Logging { def onPartitionsRevoked(partitions: Collection[TopicPartition]): Unit = { }}) consumer.poll(time.Duration.ofSeconds(3L)) -assertTrue(assignSemaphore.tryAcquire(1, TimeUnit.SECONDS), "Assignment did not complete on time") +TestUtils.waitUntilTrue(() => assignSemaphore.tryAcquire(100, TimeUnit.MILLISECONDS), + "Assignment did not complete on time") Review comment: Could the `ConsumerRebalanceListener` be called if we don't 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