Skip to content
Permalink
Browse files
fix: Set up DirectPath e2e tests correctly (#780)
* chore: add DirectPath fallback integration test

* fix: Set up DirectPath e2e tests correctly
  • Loading branch information
mohanli-ml committed Jan 7, 2021
1 parent beeac09 commit 9b94c6ef54776fdb8868acf04e371599b7500d57
Showing with 10 additions and 6 deletions.
  1. +10 −6 google-cloud-spanner/src/test/java/com/google/cloud/spanner/GceTestEnvConfig.java
@@ -70,12 +70,6 @@ public GceTestEnvConfig() {
SpannerOptions.newBuilder()
.setAutoThrottleAdministrativeRequests()
.setTrackTransactionStarter();
InstantiatingGrpcChannelProvider.Builder defaultChannelProviderBuilder =
InstantiatingGrpcChannelProvider.newBuilder();
if (attemptDirectPath) {
builder.setChannelProvider(
defaultChannelProviderBuilder.setEndpoint(DIRECT_PATH_ENDPOINT).build());
}
if (!projectId.isEmpty()) {
builder.setProjectId(projectId);
}
@@ -96,6 +90,16 @@ public GceTestEnvConfig() {
interceptorProvider.with(new DirectPathAddressCheckInterceptor(directPathTestScenario));
}
builder.setInterceptorProvider(interceptorProvider);
// DirectPath tests need to set a custom endpoint to the ChannelProvider
InstantiatingGrpcChannelProvider.Builder customChannelProviderBuilder =
InstantiatingGrpcChannelProvider.newBuilder();
if (attemptDirectPath) {
customChannelProviderBuilder
.setEndpoint(DIRECT_PATH_ENDPOINT)
.setAttemptDirectPath(true)
.setInterceptorProvider(interceptorProvider);
builder.setChannelProvider(customChannelProviderBuilder.build());
}
options = builder.build();
}

0 comments on commit 9b94c6e

Please sign in to comment.