dengziming commented on code in PR #12108:
URL: https://github.com/apache/kafka/pull/12108#discussion_r867294879


##########
core/src/test/scala/unit/kafka/utils/TestUtils.scala:
##########
@@ -1127,6 +1127,23 @@ object TestUtils extends Logging {
       throw new IllegalStateException(s"Cannot get topic: $topic, partition: 
$partition in server metadata cache"))
   }
 
+  /**
+   * Wait until the kraft broker metadata have caught up to the controller
+   */
+  def waitForKRaftBrokerMetadataCatchupController(
+      brokers: Seq[KafkaBroker],
+      controllerServer: ControllerServer,
+      msg: String = "Timeout waiting for controller metadata propagating to 
brokers"
+  ): Unit = {
+    TestUtils.waitUntilTrue(
+      () => {
+        brokers.forall { broker =>
+          val metadataOffset = 
broker.metadataCache.asInstanceOf[KRaftMetadataCache].currentImage().highestOffsetAndEpoch().offset

Review Comment:
   Yes, the image is reset when we start publishing so it's still not very 
accurate, I added a `MetadataPublisher.publishedOffset` method to accomplish 
this.



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