merlimat opened a new pull request, #25474:
URL: https://github.com/apache/pulsar/pull/25474
## Motivation
`IsolatedBookieEnsemblePlacementPolicyTest.testMetadataStoreCases` is flaky
because it uses `Thread.sleep`-based timing to control when
`CompletableFuture`s complete. On fast machines, the background thread can
complete earlier than expected, causing `getExcludedBookiesWithIsolationGroups`
to see the updated cache value before the test expects it.
### Stack trace
```
IsolatedBookieEnsemblePlacementPolicyTest > testMetadataStoreCases FAILED
java.lang.AssertionError: expected [true] but found [false]
at org.testng.Assert.fail(Assert.java:110)
at org.testng.Assert.failNotEquals(Assert.java:1577)
at org.testng.Assert.assertTrue(Assert.java:56)
at org.testng.Assert.assertTrue(Assert.java:66)
at
IsolatedBookieEnsemblePlacementPolicyTest.testMetadataStoreCases(IsolatedBookieEnsemblePlacementPolicyTest.java:212)
```
## Modifications
Replace the `Thread.sleep`-based timing with manually-controlled
`CompletableFuture` completion at the exact test points where the futures
should transition from pending to complete. This eliminates the timing race
entirely.
### Documentation
- [x] `doc-not-needed`
--
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]