|
29 | 29 | */
|
30 | 30 | package com.google.api.gax.rpc;
|
31 | 31 |
|
| 32 | +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; |
32 | 33 | import static org.junit.jupiter.api.Assertions.assertThrows;
|
33 | 34 |
|
34 | 35 | import com.google.api.gax.core.NoCredentialsProvider;
|
35 | 36 | import com.google.api.gax.rpc.mtls.MtlsProvider;
|
36 | 37 | import com.google.api.gax.rpc.testing.FakeMtlsProvider;
|
37 | 38 | import com.google.auth.Credentials;
|
| 39 | +import com.google.auth.oauth2.ComputeEngineCredentials; |
38 | 40 | import com.google.common.truth.Truth;
|
39 | 41 | import io.grpc.Status;
|
40 | 42 | import java.io.IOException;
|
@@ -437,4 +439,19 @@ void hasValidUniverseDomain_credentialsInGDU_configNonGDU() throws IOException {
|
437 | 439 | UnauthenticatedException.class,
|
438 | 440 | () -> endpointContext.validateUniverseDomain(credentials, statusCode));
|
439 | 441 | }
|
| 442 | + |
| 443 | + // (TODO: b/349488459) - Disable automatic requests to MDS until 01/2025 |
| 444 | + // Test is to ensure that no validation is being run for ComputeEngineCredentials |
| 445 | + @Test |
| 446 | + void hasValidUniverseDomain_computeEngineCredentials_noValidationOnUniverseDomain() |
| 447 | + throws IOException { |
| 448 | + Credentials credentials = Mockito.mock(ComputeEngineCredentials.class); |
| 449 | + Mockito.when(credentials.getUniverseDomain()).thenReturn(Credentials.GOOGLE_DEFAULT_UNIVERSE); |
| 450 | + EndpointContext endpointContext = |
| 451 | + defaultEndpointContextBuilder |
| 452 | + // Set a custom Universe Domain that doesn't match |
| 453 | + .setUniverseDomain("test.com") |
| 454 | + .build(); |
| 455 | + assertDoesNotThrow(() -> endpointContext.validateUniverseDomain(credentials, statusCode)); |
| 456 | + } |
440 | 457 | }
|
0 commit comments