Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
<threetenbp.version>1.7.0</threetenbp.version>
<junit.version>5.11.4</junit.version>
<mockito.version>4.11.0</mockito.version>
<awaitility.version>4.3.0</awaitility.version>
<slf4j.version>2.0.16</slf4j.version>
<!-- skipping clirr check for protobuf 4.x upgrade -->
<clirr.skip>true</clirr.skip>
Expand Down
2 changes: 2 additions & 0 deletions sdk-platform-java/gax-java/dependencies.properties
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,5 @@ maven.io_opentelemetry_opentelemetry_sdk=io.opentelemetry:opentelemetry-sdk:1.57
maven.io_opentelemetry_opentelemetry_sdk_common=io.opentelemetry:opentelemetry-sdk-common:1.57.0
maven.io_opentelemetry_opentelemetry_sdk_metrics=io.opentelemetry:opentelemetry-sdk-metrics:1.57.0
maven.com_google_guava_guava_testlib=com.google.guava:guava-testlib:32.1.3-jre
maven.org_awaitility_awaitility=org.awaitility:awaitility:4.3.0

1 change: 1 addition & 0 deletions sdk-platform-java/gax-java/gax/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ _TEST_COMPILE_DEPS = [
"@io_opentelemetry_opentelemetry_sdk_metrics//jar",
"@io_opentelemetry_opentelemetry_sdk_common//jar",
"@com_google_guava_guava_testlib//jar",
"@org_awaitility_awaitility//jar",
]

java_library(
Expand Down
5 changes: 5 additions & 0 deletions sdk-platform-java/gax-java/gax/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
package com.google.api.gax.batching;

import static com.google.common.truth.Truth.assertThat;
import static org.awaitility.Awaitility.await;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.ArgumentMatchers.any;
Expand All @@ -44,6 +45,7 @@
import com.google.api.gax.batching.FlowController.FlowControlException;
import com.google.api.gax.batching.FlowController.LimitExceededBehavior;
import com.google.common.collect.ImmutableList;
import java.time.Duration;
import java.util.AbstractMap.SimpleEntry;
import java.util.ArrayList;
import java.util.Arrays;
Expand Down Expand Up @@ -194,14 +196,16 @@ void testBatching() throws Exception {
batcher.add(SimpleBatch.fromInteger(3));
batcher.add(SimpleBatch.fromInteger(5));
// Give time for the executor to push the batch
Thread.sleep(100);
assertThat(receiver.getBatches()).hasSize(1);
await()
.atMost(Duration.ofSeconds(5))
.untilAsserted(() -> assertThat(receiver.getBatches()).hasSize(1));

batcher.add(SimpleBatch.fromInteger(7));
batcher.add(SimpleBatch.fromInteger(9));
// Give time for the executor to push the batch
Thread.sleep(100);
assertThat(receiver.getBatches()).hasSize(2);
await()
.atMost(Duration.ofSeconds(5))
.untilAsserted(() -> assertThat(receiver.getBatches()).hasSize(2));

batcher.add(SimpleBatch.fromInteger(11));

Expand All @@ -228,8 +232,9 @@ void testBatchingWithDelay() throws Exception {
batcher.add(SimpleBatch.fromInteger(3));
batcher.add(SimpleBatch.fromInteger(5));
// Give time for the delay to trigger and push the batch
Thread.sleep(500);
assertThat(receiver.getBatches()).hasSize(1);
await()
.atMost(Duration.ofSeconds(5))
.untilAsserted(() -> assertThat(receiver.getBatches()).hasSize(1));

batcher.add(SimpleBatch.fromInteger(11));

Expand Down
6 changes: 6 additions & 0 deletions sdk-platform-java/gax-java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,12 @@
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<version>${awaitility.version}</version>
<scope>test</scope>
</dependency>
Comment thread
blakeli0 marked this conversation as resolved.
</dependencies>
</dependencyManagement>

Expand Down
Loading