Skip to content

Commit 2be5968

Browse files
committed
test: add new it for scenarios
1 parent a8a51a8 commit 2be5968

1 file changed

Lines changed: 54 additions & 0 deletions

File tree

java-bigquery-jdbc/src/test/java/com/google/cloud/bigquery/jdbc/it/ITOpenTelemetryTest.java

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,60 @@ public void testExecute_withErrorCorrelation() throws Exception {
164164
"Traces must contain JDBC parent span 'BigQueryStatement.executeQuery'");
165165
}
166166

167+
@Test
168+
public void testExecute_withExplicitCredentialsJson() throws Exception {
169+
// Goal: Verify that passing a raw JSON string in gcpTelemetryCredentials works and invokes our
170+
// customizer.
171+
// How to test:
172+
// If you have a test service account JSON, you can read it as a string and set it in
173+
// props/DataSource:
174+
// ds.setGcpTelemetryCredentials(saJsonString);
175+
// Verify that traces are still successfully delivered to Cloud Trace.
176+
}
177+
178+
@Test
179+
public void testExecute_withExplicitCredentialsFilePath() throws Exception {
180+
// Goal: Verify that passing a file path works.
181+
// How to test:
182+
// Save the test service account JSON to a temporary file.
183+
// Set gcpTelemetryCredentials to the tempFilePath:
184+
// ds.setGcpTelemetryCredentials(tempFilePath);
185+
// Verify trace delivery.
186+
}
187+
188+
@Test
189+
public void testExecute_withMultiTenancySdkCaching() throws Exception {
190+
// Goal: Verify that the driver correctly creates and caches separate SDK instances for
191+
// different configurations.
192+
// How to test:
193+
// Create Connection A with gcpTelemetryProjectId = "project-a".
194+
// Create Connection B with gcpTelemetryProjectId = "project-b".
195+
// Even if project-b doesn't exist or fails to export, you can verify that the driver doesn't
196+
// crash and that it attempts to create two separate pipelines.
197+
// To be rigorous, we could add a package-private method in BigQueryJdbcOpenTelemetry to return
198+
// the size of the sdkCache and assert that it is 2 after creating these connections.
199+
}
200+
201+
@Test
202+
public void testExecute_withExplicitCredentials_HTTP() throws Exception {
203+
// Scenario A: Explicit Credentials + HTTP
204+
// Goal: Verify that our customizer works for OtlpHttpSpanExporter.
205+
// How to test:
206+
// Set gcpTelemetryCredentials (JSON string or path).
207+
// Set EnableHighThroughputAPI = 0 (to force HTTP).
208+
// Verify that traces are delivered.
209+
}
210+
211+
@Test
212+
public void testExecute_withExplicitCredentials_gRPC() throws Exception {
213+
// Scenario B: Explicit Credentials + gRPC
214+
// Goal: Verify that our customizer works for OtlpGrpcSpanExporter.
215+
// How to test:
216+
// Set gcpTelemetryCredentials (JSON string or path).
217+
// Set EnableHighThroughputAPI = 1 (to force gRPC).
218+
// Verify that traces are delivered.
219+
}
220+
167221
private String verifyAndFetchLogs(String connectionUuid) throws Exception {
168222
try (Logging logging =
169223
LoggingOptions.newBuilder().setProjectId(PROJECT_ID).build().getService()) {

0 commit comments

Comments
 (0)