Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

Commit

Permalink
feat: add google-c2p dependence to DirectPath
Browse files Browse the repository at this point in the history
  • Loading branch information
mohanli-ml committed Oct 19, 2021
1 parent 8bfcd10 commit 77e81d7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
Expand Up @@ -401,7 +401,7 @@ && isOnComputeEngine()) {
return managedChannel;
}

/** The endpoint passed to the builder. It must have a pot, and must not have a URI scheme. */
/** The endpoint passed to the builder, which must have a port. */
public String getEndpoint() {
return endpoint;
}
Expand Down
Expand Up @@ -408,23 +408,22 @@ public void testWithDirectPathXds() throws IOException {
ScheduledExecutorService executor = new ScheduledThreadPoolExecutor(1);
executor.shutdown();

InstantiatingGrpcChannelProvider iProvider =
InstantiatingGrpcChannelProvider grpcChannelProvider =
InstantiatingGrpcChannelProvider.newBuilder()
.setAttemptDirectPath(true)
.setEnvProvider(new TestEnvironmentProvider(/*isDirectPathXdsEnabled = */ "true"))
.build();

TransportChannelProvider provider =
iProvider
TransportChannelProvider transportChannelProvider =
grpcChannelProvider
.withHeaders(Collections.<String, String>emptyMap())
.withExecutor((Executor) executor)
.withEndpoint("localhost:8080")
.withCredentials(ComputeEngineCredentials.create());
;

provider.getTransportChannel().shutdownNow();
transportChannelProvider.getTransportChannel().shutdownNow();

assertEquals(iProvider.getActiveEndpoint(), "google-c2p:///localhost");
assertEquals(grpcChannelProvider.getActiveEndpoint(), "google-c2p:///localhost");
}

@Test
Expand Down

0 comments on commit 77e81d7

Please sign in to comment.