Skip to content

Commit 4bfa589

Browse files
authored
test: fix testOpenTelemetryTracingDatasets by setting explicit location (#12932)
This PR fixes the testOpenTelemetryTracingDatasets failure by explicitly setting the dataset location to US, making it deterministic across environments. This test has been flaky because the environment would assign a location if it is not set explicitly. See [test failures log](https://fusion2.corp.google.com/ci/kokoro/prod:cloud-devrel%2Fclient-libraries%2Fjava%2Fgoogle-cloud-java%2Fpresubmit%2Fbigquery-integration/activity/705a7514-338b-4268-8725-9506018ae49c/log) for details.
1 parent 0720279 commit 4bfa589

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

  • java-bigquery/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/it

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7801,6 +7801,7 @@ public void testOpenTelemetryTracingDatasets() {
78017801
BigQueryOptions.newBuilder()
78027802
.setEnableOpenTelemetryTracing(true)
78037803
.setOpenTelemetryTracer(tracer)
7804+
.setLocation("US")
78047805
.build();
78057806
BigQuery bigquery = otelOptions.getService();
78067807

@@ -7818,6 +7819,7 @@ public void testOpenTelemetryTracingDatasets() {
78187819
.setDescription(DESCRIPTION)
78197820
.setMaxTimeTravelHours(72L)
78207821
.setLabels(LABELS)
7822+
.setLocation("US")
78217823
.build();
78227824

78237825
Dataset dataset = bigquery.create(info);
@@ -7839,7 +7841,7 @@ public void testOpenTelemetryTracingDatasets() {
78397841
parentSpan.end();
78407842
Map<AttributeKey<?>, Object> createMap =
78417843
OTEL_ATTRIBUTES.get("com.google.cloud.bigquery.BigQuery.createDataset");
7842-
assertEquals("null", createMap.get(AttributeKey.stringKey("bq.dataset.location")));
7844+
assertEquals("US", createMap.get(AttributeKey.stringKey("bq.dataset.location")));
78437845
assertEquals(
78447846
"DatasetService",
78457847
OTEL_ATTRIBUTES

0 commit comments

Comments
 (0)