Skip to content

Commit 9655146

Browse files
committed
fix: java 8 tests
1 parent e0ccb57 commit 9655146

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

java-bigquery/google-cloud-bigquery-jdbc/src/test/java/com/google/cloud/bigquery/jdbc/OpenTelemetryJulHandlerTest.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,11 @@ public void testPublishToOTel() {
5656
BigQueryJdbcOpenTelemetry.registerConnection(
5757
"test-uuid", otelTesting.getOpenTelemetry(), null, false);
5858

59+
BigQueryConnection mockConnection = mock(BigQueryConnection.class);
5960
Baggage baggage = Baggage.builder().put("jdbc.connection_id", "test-uuid").build();
60-
try (Scope scope = baggage.makeCurrent()) {
61+
try (Scope scope = baggage.makeCurrent();
62+
BigQueryJdbcMdc.MdcCloseable mdcScope =
63+
BigQueryJdbcMdc.registerInstance(mockConnection, "test-uuid")) {
6164
logger.info("Test message");
6265
}
6366

@@ -92,8 +95,11 @@ public void testPublishToGcp() {
9295
BigQueryJdbcOpenTelemetry.registerConnection(
9396
"gcp-uuid", otelTesting.getOpenTelemetry(), loggingClient, true);
9497

98+
BigQueryConnection mockConnection = mock(BigQueryConnection.class);
9599
Baggage baggage = Baggage.builder().put("jdbc.connection_id", "gcp-uuid").build();
96-
try (Scope scope = baggage.makeCurrent()) {
100+
try (Scope scope = baggage.makeCurrent();
101+
BigQueryJdbcMdc.MdcCloseable mdcScope =
102+
BigQueryJdbcMdc.registerInstance(mockConnection, "gcp-uuid")) {
97103
logger.info("Test message");
98104
}
99105

0 commit comments

Comments
 (0)