Skip to content

Commit 63aa302

Browse files
committed
test(bigquery): Fix flaky ITBigQueryTest#testOpenTelemetryTracingQuery
b/467063732
1 parent 7871849 commit 63aa302

File tree

1 file changed

+7
-1
lines changed
  • java-bigquery/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/it

1 file changed

+7
-1
lines changed

java-bigquery/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7889,7 +7889,13 @@ public void testOpenTelemetryTracingQuery() throws InterruptedException {
78897889
bigquery.getOptions().setDefaultJobCreationMode(JobCreationMode.JOB_CREATION_OPTIONAL);
78907890
TableResult tableResult = executeSimpleQuery(bigquery);
78917891
assertNotNull(tableResult.getQueryId());
7892-
assertNull(tableResult.getJobId());
7892+
7893+
// Safely handle the fallback where BigQuery decides to create a job anyway
7894+
if (tableResult.getJobCreationReason() != null) {
7895+
assertNotNull(tableResult.getJobId());
7896+
assertEquals(tableResult.getQueryId(), tableResult.getJobId().getJob());
7897+
assertEquals(JobCreationReason.Code.OTHER, tableResult.getJobCreationReason().getCode());
7898+
}
78937899

78947900
assertNotNull(OTEL_ATTRIBUTES.get("com.google.cloud.bigquery.BigQuery.queryRpc"));
78957901
assertNotNull(

0 commit comments

Comments
 (0)