Skip to content

Commit 920d562

Browse files
authored
test(gax): fix flakiness in BatcherImplTest.testElementsNotLeaking (#13572)
Increase the timeout and use Awaitility to wait for the background task to complete. This avoids timing out on slower machines (like macOS Intel). Fixes #13565
1 parent 95c7774 commit 920d562

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

sdk-platform-java/gax-java/gax/src/test/java/com/google/api/gax/batching/BatcherImplTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,6 @@ void testWhenDelayThresholdExceeds() throws Exception {
516516

517517
/** Validates that the elements are not leaking to multiple batches */
518518
@Test
519-
@Timeout(value = 500, unit = TimeUnit.MILLISECONDS)
520519
void testElementsNotLeaking() throws Exception {
521520
ExecutorService singleThreadExecutor = Executors.newSingleThreadExecutor();
522521
ScheduledExecutorService multiThreadExecutor = Executors.newScheduledThreadPool(20);
@@ -567,7 +566,7 @@ public ApiFuture<List<Integer>> futureCall(
567566
}
568567

569568
// Closing the resources
570-
future.get();
569+
future.get(10, TimeUnit.SECONDS);
571570
assertThat(isDuplicateElement.get()).isFalse();
572571
singleThreadExecutor.shutdown();
573572
multiThreadExecutor.shutdown();

0 commit comments

Comments
 (0)