aoli-al opened a new pull request, #18418: URL: https://github.com/apache/kafka/pull/18418
*More detailed description of your change, if necessary. The PR title and PR message become the squashed commit message, so use a separate comment to ping reviewers.* This PR fixes [KAFKA-18418](https://issues.apache.org/jira/browse/KAFKA-18418). KafkaStreamsTest uses `Thread.sleep` to prevent threads from terminating. This introduces flaky tests if the sleep duration is not long enough. This patch fixes the issue by replacing the `Thread.sleep` with a `CountDownLatch`. The `CountDownLatch` will be released after assertions are validated. *Summary of testing strategy (including rationale) for the feature or bug fix. Unit and/or integration tests are expected for any behaviour change and system tests should be considered for larger changes.* I tested the proposed fix against the patch: https://github.com/aoli-al/kafka/commit/aced4f1430139c315809cceca26558416140883d and verified that all tests have passed. I also tested the new code using [Fray](https://github.com/cmu-pasta/fray) (the tool that found the bug), and Fray did not report any bug using the POS strategy after 10 minutes. ### 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
