jim0987795064 commented on code in PR #20068: URL: https://github.com/apache/kafka/pull/20068#discussion_r2257295892
########## core/src/test/scala/integration/kafka/api/PlaintextAdminIntegrationTest.scala: ########## @@ -2850,6 +2851,33 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { } } + /** + * Waits until the metadata for the given partition has fully propagated + * and become consistent across all brokers. + * + * This method repeatedly checks the leader information for the specified + * TopicPartition in each broker's metadata cache. It compares all brokers' + * views against the leader reported by the head broker. The loop continues + * until all brokers agree on the same leader, ensuring metadata consistency. + * + * This is useful in integration tests where operations such as + * preferred leader election or other metadata updates require + * propagation time before assertions can be made reliably. + */ + def sleepMillisToPropagateMetadata(partition: TopicPartition): Unit = { + var allSynced: Boolean = false + + while (!allSynced) { Review Comment: @chia7712 Thanks for this feedback, I've rewrite sleepMillisToPropagateMetadata as above. -- 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