Skip to content

Commit

Permalink
fix: Set up DirectPath e2e tests correctly (#780)
Browse files Browse the repository at this point in the history
* 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 9b94c6e
Showing 1 changed file with 10 additions and 6 deletions.
Expand Up @@ -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);
}
Expand All @@ -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();
}

Expand Down

0 comments on commit 9b94c6e

Please sign in to comment.