-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add an option to enable DirectPath xDS #1643
Changes from 2 commits
0dbe3d3
6340408
e12e08c
be11d2a
ddf08a8
74bcea2
39dd8f1
86b2c58
0b3c70a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -273,6 +273,31 @@ public void testWithGCECredentials() throws IOException { | |
provider.getTransportChannel().shutdownNow(); | ||
} | ||
|
||
@Test | ||
public void testDirectPathXds() throws IOException { | ||
ScheduledExecutorService executor = new ScheduledThreadPoolExecutor(1); | ||
executor.shutdown(); | ||
|
||
TransportChannelProvider provider = | ||
InstantiatingGrpcChannelProvider.newBuilder() | ||
.setAttemptDirectPath(true) | ||
.setAttemptDirectPathXds() | ||
.build() | ||
.withExecutor((Executor) executor) | ||
.withHeaders(Collections.<String, String>emptyMap()) | ||
.withEndpoint("localhost:8080"); | ||
|
||
assertThat(provider.needsCredentials()).isTrue(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure I understand this test case, does |
||
if (InstantiatingGrpcChannelProvider.isOnComputeEngine()) { | ||
provider = provider.withCredentials(ComputeEngineCredentials.create()); | ||
} else { | ||
provider = provider.withCredentials(CloudShellCredentials.create(3000)); | ||
} | ||
assertThat(provider.needsCredentials()).isFalse(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why |
||
|
||
provider.getTransportChannel().shutdownNow(); | ||
} | ||
|
||
@Test | ||
public void testWithNonGCECredentials() throws IOException { | ||
ScheduledExecutorService executor = new ScheduledThreadPoolExecutor(1); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add one more test case for the default value? Our sonar check is failing because the new code is lacking coverage, I know we cannot set environment variable in unit tests, but we should be able to test the default case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added. PTAL. Thanks!