test(bigquerystorage): create sessions using await() to address flakiness#13489
test(bigquerystorage): create sessions using await() to address flakiness#13489whowes wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request adds the Awaitility library as a test dependency and updates the integration tests in both v1beta1 and v1beta2 versions of ITBigQueryStorageTest to poll for read session creation while ignoring NotFoundException. The review feedback suggests using the fully qualified java.time.Duration class name in the await() blocks to prevent potential compilation conflicts with other commonly imported Duration classes.
| ReadSession session = | ||
| await() | ||
| .atMost(Duration.ofSeconds(30)) | ||
| .pollInterval(Duration.ofSeconds(1)) | ||
| .ignoreException(NotFoundException.class) | ||
| .until(() -> client.createReadSession(request), Objects::nonNull); |
There was a problem hiding this comment.
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.
| 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); |
| ReadSession session = | ||
| await() | ||
| .atMost(Duration.ofSeconds(30)) | ||
| .pollInterval(Duration.ofSeconds(1)) | ||
| .ignoreException(NotFoundException.class) | ||
| .until(() -> client.createReadSession(request), Objects::nonNull); |
There was a problem hiding this comment.
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.
| 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); |
1c21458 to
5125249
Compare
5125249 to
3a53327
Compare
Recurring test flakes (#11964, #12981) have resulted when metadata for tables created via bigquery.googleapis.com are not immediately available for reading via bigquerystorage.googleapis.com. This PR introduces Awaitility to bigquerystorage and uses it in the flaky ITBigQueryStorageTest classes to retry creating ReadSessions when they fail with NotFoundExceptions.
Fixes #11964