Skip to content
Draft
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
6 changes: 6 additions & 0 deletions google-cloud-jar-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@
</dependency>

<!-- Test dependencies -->
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<version>4.3.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down
5 changes: 5 additions & 0 deletions java-bigquerystorage/google-cloud-bigquerystorage/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,11 @@
<artifactId>opentelemetry-sdk-trace</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@

package com.google.cloud.bigquery.storage.v1beta1.it;

import static org.awaitility.Awaitility.await;
import com.google.api.gax.rpc.NotFoundException;
import java.util.Objects;

import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assertWithMessage;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
Expand Down Expand Up @@ -1230,7 +1234,13 @@ private void ProcessRowsAtSnapshot(
TableReadOptions.newBuilder().setRowRestriction(filter).build());
}

ReadSession session = client.createReadSession(createSessionRequestBuilder.build());
final CreateReadSessionRequest request = createSessionRequestBuilder.build();
ReadSession session =
await()
.atMost(Duration.ofSeconds(30))
.pollInterval(Duration.ofSeconds(1))
.ignoreException(NotFoundException.class)
.until(() -> client.createReadSession(request), Objects::nonNull);
Comment on lines +1238 to +1243

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

To prevent potential compilation errors due to class name conflicts (e.g., with com.google.protobuf.Duration or org.threeten.bp.Duration which are commonly imported in client library tests), it is safer to use the fully qualified java.time.Duration class name.

Suggested change
ReadSession session =
await()
.atMost(Duration.ofSeconds(30))
.pollInterval(Duration.ofSeconds(1))
.ignoreException(NotFoundException.class)
.until(() -> client.createReadSession(request), Objects::nonNull);
ReadSession session =
await()
.atMost(java.time.Duration.ofSeconds(30))
.pollInterval(java.time.Duration.ofSeconds(1))
.ignoreException(NotFoundException.class)
.until(() -> client.createReadSession(request), Objects::nonNull);

assertEquals(
1,
session.getStreamsCount(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@

package com.google.cloud.bigquery.storage.v1beta2.it;

import static org.awaitility.Awaitility.await;
import com.google.api.gax.rpc.NotFoundException;
import java.util.Objects;

import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assertWithMessage;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
Expand Down Expand Up @@ -1211,7 +1215,13 @@ private void ProcessRowsAtSnapshot(
.setReadOptions(TableReadOptions.newBuilder().setRowRestriction(filter).build());
}

ReadSession session = client.createReadSession(createSessionRequestBuilder.build());
final CreateReadSessionRequest request = createSessionRequestBuilder.build();
ReadSession session =
await()
.atMost(Duration.ofSeconds(30))
.pollInterval(Duration.ofSeconds(1))
.ignoreException(NotFoundException.class)
.until(() -> client.createReadSession(request), Objects::nonNull);
Comment on lines +1219 to +1224

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

To prevent potential compilation errors due to class name conflicts (e.g., with com.google.protobuf.Duration or org.threeten.bp.Duration which are commonly imported in client library tests), it is safer to use the fully qualified java.time.Duration class name.

Suggested change
ReadSession session =
await()
.atMost(Duration.ofSeconds(30))
.pollInterval(Duration.ofSeconds(1))
.ignoreException(NotFoundException.class)
.until(() -> client.createReadSession(request), Objects::nonNull);
ReadSession session =
await()
.atMost(java.time.Duration.ofSeconds(30))
.pollInterval(java.time.Duration.ofSeconds(1))
.ignoreException(NotFoundException.class)
.until(() -> client.createReadSession(request), Objects::nonNull);

assertEquals(
1,
session.getStreamsCount(),
Expand Down
Loading