[bluetooth] Try to make tests more stable No.2 (#9309)
* [bluetooth] Try to make tests more stable No.2 Signed-off-by: Fabian Wolter <github@fabian-wolter.de>
This commit is contained in:
parent
3bd17f4788
commit
941189ad55
|
@ -115,7 +115,7 @@ class RetryFutureTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
void composeWithRetry1() throws InterruptedException {
|
||||
void composeWithRetry1() {
|
||||
AtomicInteger visitCount = new AtomicInteger();
|
||||
CompletableFuture<String> composedFuture = new CompletableFuture<>();
|
||||
Future<String> retryFuture = RetryFuture.composeWithRetry(() -> {
|
||||
|
@ -152,11 +152,12 @@ class RetryFutureTest {
|
|||
if (!latch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
|
||||
fail("Timeout while waiting for latch");
|
||||
}
|
||||
Thread.sleep(1);
|
||||
retryFuture.cancel(false);
|
||||
|
||||
assertTrue(composedFuture.isCancelled());
|
||||
} catch (InterruptedException e) {
|
||||
Future<Boolean> future = scheduler.submit(() -> {
|
||||
retryFuture.cancel(false);
|
||||
return composedFuture.isCancelled();
|
||||
});
|
||||
assertTrue(future.get(TIMEOUT_MS, TimeUnit.MILLISECONDS));
|
||||
} catch (InterruptedException | ExecutionException | TimeoutException e) {
|
||||
fail(e);
|
||||
}
|
||||
assertEquals(2, visitCount.get());
|
||||
|
|
Loading…
Reference in New Issue