Skip to content

Commit decdf94

Browse files
authored
test(gax-grpc): run the full unit test suite in CI (#14573)
Fixes #14572. The Surefire `<test>` value in gax-grpc ended with an entry without a `!`. Surefire treats that as an inclusion pattern, so only `InstantiatingGrpcChannelProviderTest#testLogDirectPathMisconfigWrongCredential` ran in CI. - **`gax-grpc/pom.xml`:** drop the stray inclusion and keep both existing exclusions. - **`InstantiatingGrpcChannelProviderTest#testLogDirectPathMisconfigWrongCredential`:** set `.setEnvProvider(name -> null)`, so the test no longer depends on the machine's `GOOGLE_CLOUD_DISABLE_DIRECT_PATH`. With it set to `true`, the test fails because the provider takes the "DirectPath disabled" branch. It passed on GitHub runners only because the variable isn't set there. **Testing:** `mvn test -pl gax-grpc` now runs 209 tests, all passing, locally on JDK 21. Before, it ran 1.
1 parent 6bb477b commit decdf94

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎sdk-platform-java/gax-java/gax-grpc/pom.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@
158158
<artifactId>maven-surefire-plugin</artifactId>
159159
<configuration>
160160
<!-- These tests require an Env Var to be set. Use -PenvVarTest to ONLY run these tests -->
161-
<test>!InstantiatingGrpcChannelProviderTest#testLogDirectPathMisconfig_AttemptDirectPathNotSetAndAttemptDirectPathXdsSetViaEnv_warns,!InstantiatingGrpcChannelProviderTest#canUseDirectPath_directPathEnvVarNotSet_attemptDirectPathIsTrue,InstantiatingGrpcChannelProviderTest#testLogDirectPathMisconfigWrongCredential</test>
161+
<test>!InstantiatingGrpcChannelProviderTest#testLogDirectPathMisconfig_AttemptDirectPathNotSetAndAttemptDirectPathXdsSetViaEnv_warns,!InstantiatingGrpcChannelProviderTest#canUseDirectPath_directPathEnvVarNotSet_attemptDirectPathIsTrue</test>
162162
<!-- <test>!InstantiatingGrpcChannelProviderTest#testLogDirectPathMisconfig_AttemptDirectPathNotSetAndAttemptDirectPathXdsSetViaEnv_warns</test> -->
163163
</configuration>
164164
</plugin>

‎sdk-platform-java/gax-java/gax-grpc/src/test/java/com/google/api/gax/grpc/GrpcLoggingInterceptorTest.java‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232

3333
import static org.mockito.ArgumentMatchers.any;
3434
import static org.mockito.Mockito.mock;
35-
import static org.mockito.Mockito.spy;
3635
import static org.mockito.Mockito.verify;
3736
import static org.mockito.Mockito.when;
3837

@@ -83,7 +82,7 @@ void testInterceptor_basic() {
8382
void testInterceptor_responseListener() {
8483
when(channel.newCall(Mockito.<MethodDescriptor<String, Integer>>any(), any(CallOptions.class)))
8584
.thenReturn(call);
86-
GrpcLoggingInterceptor interceptor = spy(new GrpcLoggingInterceptor());
85+
GrpcLoggingInterceptor interceptor = new GrpcLoggingInterceptor();
8786
Channel intercepted = ClientInterceptors.intercept(channel, interceptor);
8887
@SuppressWarnings("unchecked")
8988
ClientCall.Listener<Integer> listener = mock(ClientCall.Listener.class);

‎sdk-platform-java/gax-java/gax-grpc/src/test/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProviderTest.java‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,7 @@ void testLogDirectPathMisconfigWrongCredential() throws Exception {
710710
InstantiatingGrpcChannelProvider.newBuilder()
711711
.setAttemptDirectPathXds()
712712
.setAttemptDirectPath(true)
713+
.setEnvProvider(name -> null)
713714
.setHeaderProvider(
714715
mock(HeaderProvider.class, Mockito.withSettings().withoutAnnotations()))
715716
.setExecutor(mock(Executor.class))

0 commit comments

Comments
 (0)