splett2 opened a new pull request, #14695: URL: https://github.com/apache/kafka/pull/14695
### What TestUtils.createTopicWithAdmin calls `waitForAllPartitionsMetadata` which waits for partition(s) to be present in each brokers' metadata cache. This is a sufficient check in ZK mode because the controller sends an LISR request before sending an UpdateMetadataRequest which means that the partition in the `ReplicaManager` will be updated before the metadata cache. In KRaft mode, the metadata cache is updated first, so the check may return before partitions and other metadata listeners are fully initialized. ### Testing Insert a `Thread.sleep(100)` in `BrokerMetadataPublisher.onMetadataUpdate` after ``` // Publish the new metadata image to the metadata cache. metadataCache.setImage(newImage) ``` and run `EdgeCaseRequestTest.testProduceRequestWithNullClientId` and the test will fail locally nearly deterministically. After the change(s), the test no longer fails. ### Committer Checklist (excluded from commit message) - [ ] Verify design and implementation - [ ] Verify test coverage and CI build status - [ ] Verify documentation (including upgrade notes) -- 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