@@ -292,6 +292,28 @@ public void testDirectPathDisallowNullCredentials() throws IOException {
292
292
assertThat (provider .isCredentialDirectPathCompatible ()).isFalse ();
293
293
}
294
294
295
+ @ Test
296
+ public void testDirectPathWithGDUEndpoint () {
297
+ InstantiatingGrpcChannelProvider provider =
298
+ InstantiatingGrpcChannelProvider .newBuilder ()
299
+ .setAttemptDirectPath (true )
300
+ .setAttemptDirectPathXds ()
301
+ .setEndpoint ("test.googleapis.com:443" )
302
+ .build ();
303
+ assertThat (provider .canUseDirectPathWithUniverseDomain ()).isTrue ();
304
+ }
305
+
306
+ @ Test
307
+ public void testDirectPathWithNonGDUEndpoint () {
308
+ InstantiatingGrpcChannelProvider provider =
309
+ InstantiatingGrpcChannelProvider .newBuilder ()
310
+ .setAttemptDirectPath (true )
311
+ .setAttemptDirectPathXds ()
312
+ .setEndpoint ("test.random.com:443" )
313
+ .build ();
314
+ assertThat (provider .canUseDirectPathWithUniverseDomain ()).isFalse ();
315
+ }
316
+
295
317
@ Test
296
318
public void testDirectPathXdsEnabled () throws IOException {
297
319
InstantiatingGrpcChannelProvider provider =
@@ -565,22 +587,6 @@ public void testLogDirectPathMisconfigNotOnGCE() {
565
587
InstantiatingGrpcChannelProvider .LOG .removeHandler (logHandler );
566
588
}
567
589
568
- @ Test
569
- public void testLogDirectPathMisconfigNotInGDU () {
570
- FakeLogHandler logHandler = new FakeLogHandler ();
571
- InstantiatingGrpcChannelProvider .LOG .addHandler (logHandler );
572
- InstantiatingGrpcChannelProvider provider =
573
- InstantiatingGrpcChannelProvider .newBuilder ()
574
- .setAttemptDirectPathXds ()
575
- .setAttemptDirectPath (true )
576
- .setAllowNonDefaultServiceAccount (true )
577
- .setEndpoint ("test.random.endpoint.com:443" )
578
- .build ();
579
- assertThat (logHandler .getAllMessages ())
580
- .contains ("DirectPath will only work in the the googleapis.com Universe Domain" );
581
- InstantiatingGrpcChannelProvider .LOG .removeHandler (logHandler );
582
- }
583
-
584
590
private static class FakeLogHandler extends Handler {
585
591
List <LogRecord > records = new ArrayList <>();
586
592
0 commit comments