Repository navigation
test(bigquery-jdbc): align ITOpenTelemetryTest with per-connection proxy, TrustStore, and GAPIC Logging - #15368
Conversation
…oxy, TrustStore, and GAPIC Logging
There was a problem hiding this comment.
Code Review
This pull request refactors ITOpenTelemetryTest.java to programmatically configure proxies and custom SSL TrustStores for verification clients, replacing the previous system-property-based approach. It introduces VerificationCredentials and helper methods to build customized HTTP clients and gRPC transport channel providers, and updates log fetching to use LoggingClient with a time-bounded filter. Feedback suggests failing fast with an IllegalArgumentException if a custom SSL TrustStore is specified but the channel builder is not an instance of NettyChannelBuilder, preventing silent configuration failures.
| if (sslTrustStorePath != null | ||
| && !sslTrustStorePath.trim().isEmpty() | ||
| && builder instanceof NettyChannelBuilder) { | ||
| try { | ||
| TrustManagerFactory tmf = | ||
| loadTrustManagerFactory( | ||
| sslTrustStorePath, | ||
| sslTrustStorePassword, | ||
| sslTrustStoreType, | ||
| sslTrustStoreProvider); | ||
| SslContext sslContext = GrpcSslContexts.forClient().trustManager(tmf).build(); | ||
| ((NettyChannelBuilder) builder).sslContext(sslContext); | ||
| } catch (IOException | GeneralSecurityException e) { | ||
| throw new IllegalStateException("Failed to configure test SSL TrustStore", e); | ||
| } | ||
| } |
There was a problem hiding this comment.
If a custom SSL TrustStore is configured but the builder is not an instance of NettyChannelBuilder, the configuration is silently ignored. This can lead to confusing SSL handshake failures that are difficult to debug. Consider throwing an IllegalArgumentException or failing fast if the builder type is unsupported when a TrustStore is explicitly requested.
if (sslTrustStorePath != null && !sslTrustStorePath.trim().isEmpty()) {
if (builder instanceof NettyChannelBuilder) {
try {
TrustManagerFactory tmf =
loadTrustManagerFactory(
sslTrustStorePath,
sslTrustStorePassword,
sslTrustStoreType,
sslTrustStoreProvider);
SslContext sslContext = GrpcSslContexts.forClient().trustManager(tmf).build();
((NettyChannelBuilder) builder).sslContext(sslContext);
} catch (IOException | GeneralSecurityException e) {
throw new IllegalStateException("Failed to configure test SSL TrustStore", e);
}
} else {
throw new IllegalArgumentException(
"SSL TrustStore configuration is only supported with NettyChannelBuilder, but got: "
+ builder.getClass().getName());
}
}
Summary
Aligns
ITOpenTelemetryTestverification clients with per-connectionuniverseDomain, HTTP proxy (authenticated and unauthenticated), andSSLTrustStore*settings, and switches its log-reading client to GAPICLoggingClient.Key Decisions
LoggingClientfor test log verification: Usescom.google.cloud.logging.v2.LoggingClientwithTransportChannelProviderso log verification works through proxies and customSSLTrustStores alongsideTraceServiceClient.ServiceAccountCredentialswith managed HTTP client lifecycle: Uses non-deprecatedServiceAccountCredentials.fromStream(withcloud-platformscope) wrapped in anAutoCloseableholder that always closes the verificationCloseableHttpClientwhen a proxy or TrustStore is configured.@Tag("disable_universe_domain")until verified on a live custom universe: Preserves the tag in this PR until the suite is executed end-to-end against a live custom-universe environment.Behavior Changes
ITOpenTelemetryTestverification clients now honoruniverseDomain,ProxyHost/ProxyPort/ProxyUid/ProxyPwd, andSSLTrustStore*fromconnectionUrlwithout leaking HTTP clients.ListLogEntriesRequestwith a 24-hour timestamp filter.