From a17747d2b4578088682e0c82e4b7fe295b34641f Mon Sep 17 00:00:00 2001 From: Lawrence Qiu Date: Mon, 29 Jun 2026 19:15:31 +0000 Subject: [PATCH 1/2] test(gax): fix flakiness in BatcherImplTest.testElementsNotLeaking Increase the timeout and use Awaitility to wait for the background task to complete. This avoids timing out on slower machines (like macOS Intel). TAG=agy CONV=35be4f5a-1538-41fd-9d27-8671b6accae7 --- .../test/java/com/google/api/gax/batching/BatcherImplTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk-platform-java/gax-java/gax/src/test/java/com/google/api/gax/batching/BatcherImplTest.java b/sdk-platform-java/gax-java/gax/src/test/java/com/google/api/gax/batching/BatcherImplTest.java index ce4f43b45c53..87e73528e672 100644 --- a/sdk-platform-java/gax-java/gax/src/test/java/com/google/api/gax/batching/BatcherImplTest.java +++ b/sdk-platform-java/gax-java/gax/src/test/java/com/google/api/gax/batching/BatcherImplTest.java @@ -516,7 +516,6 @@ void testWhenDelayThresholdExceeds() throws Exception { /** Validates that the elements are not leaking to multiple batches */ @Test - @Timeout(value = 500, unit = TimeUnit.MILLISECONDS) void testElementsNotLeaking() throws Exception { ExecutorService singleThreadExecutor = Executors.newSingleThreadExecutor(); ScheduledExecutorService multiThreadExecutor = Executors.newScheduledThreadPool(20); @@ -567,6 +566,7 @@ public ApiFuture> futureCall( } // Closing the resources + await().atMost(Duration.ofSeconds(10)).until(future::isDone); future.get(); assertThat(isDuplicateElement.get()).isFalse(); singleThreadExecutor.shutdown(); From f52ef0f82b60d53e0b48cb7cccabe7cf87f3fcae Mon Sep 17 00:00:00 2001 From: Lawrence Qiu Date: Mon, 29 Jun 2026 15:29:58 -0400 Subject: [PATCH 2/2] Update sdk-platform-java/gax-java/gax/src/test/java/com/google/api/gax/batching/BatcherImplTest.java Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- .../test/java/com/google/api/gax/batching/BatcherImplTest.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sdk-platform-java/gax-java/gax/src/test/java/com/google/api/gax/batching/BatcherImplTest.java b/sdk-platform-java/gax-java/gax/src/test/java/com/google/api/gax/batching/BatcherImplTest.java index 87e73528e672..a6489aa26aff 100644 --- a/sdk-platform-java/gax-java/gax/src/test/java/com/google/api/gax/batching/BatcherImplTest.java +++ b/sdk-platform-java/gax-java/gax/src/test/java/com/google/api/gax/batching/BatcherImplTest.java @@ -566,8 +566,7 @@ public ApiFuture> futureCall( } // Closing the resources - await().atMost(Duration.ofSeconds(10)).until(future::isDone); - future.get(); + future.get(10, TimeUnit.SECONDS); assertThat(isDuplicateElement.get()).isFalse(); singleThreadExecutor.shutdown(); multiThreadExecutor.shutdown();