Skip to content

Commit 554329e

Browse files
authored
chore: Fix flaky InstantiatingGrpcChannelProviderTest on Mac (#3010)
Fixes #2852 Result of manually invoked nightly run: https://github.com/googleapis/sdk-platform-java/actions/runs/9782209009
1 parent aad24f6 commit 554329e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

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

+8-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ public static void setupClass() {
8989

9090
@BeforeEach
9191
public void setup() throws IOException {
92-
System.setProperty("os.name", "Linux");
9392
computeEngineCredentials = Mockito.mock(ComputeEngineCredentials.class);
9493
}
9594

@@ -686,6 +685,7 @@ void testLogDirectPathMisconfigNotOnGCE() throws Exception {
686685

687686
@Test
688687
public void canUseDirectPath_happyPath() {
688+
System.setProperty("os.name", "Linux");
689689
EnvironmentProvider envProvider = Mockito.mock(EnvironmentProvider.class);
690690
Mockito.when(
691691
envProvider.getenv(
@@ -704,6 +704,7 @@ public void canUseDirectPath_happyPath() {
704704

705705
@Test
706706
public void canUseDirectPath_directPathEnvVarDisabled() {
707+
System.setProperty("os.name", "Linux");
707708
EnvironmentProvider envProvider = Mockito.mock(EnvironmentProvider.class);
708709
Mockito.when(
709710
envProvider.getenv(
@@ -722,6 +723,7 @@ public void canUseDirectPath_directPathEnvVarDisabled() {
722723

723724
@Test
724725
public void canUseDirectPath_directPathEnvVarNotSet_attemptDirectPathIsTrue() {
726+
System.setProperty("os.name", "Linux");
725727
InstantiatingGrpcChannelProvider.Builder builder =
726728
InstantiatingGrpcChannelProvider.newBuilder()
727729
.setAttemptDirectPath(true)
@@ -734,6 +736,7 @@ public void canUseDirectPath_directPathEnvVarNotSet_attemptDirectPathIsTrue() {
734736

735737
@Test
736738
public void canUseDirectPath_directPathEnvVarNotSet_attemptDirectPathIsFalse() {
739+
System.setProperty("os.name", "Linux");
737740
InstantiatingGrpcChannelProvider.Builder builder =
738741
InstantiatingGrpcChannelProvider.newBuilder()
739742
.setAttemptDirectPath(false)
@@ -746,6 +749,7 @@ public void canUseDirectPath_directPathEnvVarNotSet_attemptDirectPathIsFalse() {
746749

747750
@Test
748751
public void canUseDirectPath_nonComputeCredentials() {
752+
System.setProperty("os.name", "Linux");
749753
Credentials credentials = Mockito.mock(Credentials.class);
750754
EnvironmentProvider envProvider = Mockito.mock(EnvironmentProvider.class);
751755
Mockito.when(
@@ -784,6 +788,7 @@ public void canUseDirectPath_isNotOnComputeEngine_invalidOsNameSystemProperty()
784788

785789
@Test
786790
public void canUseDirectPath_isNotOnComputeEngine_invalidSystemProductName() {
791+
System.setProperty("os.name", "Linux");
787792
EnvironmentProvider envProvider = Mockito.mock(EnvironmentProvider.class);
788793
Mockito.when(
789794
envProvider.getenv(
@@ -802,6 +807,7 @@ public void canUseDirectPath_isNotOnComputeEngine_invalidSystemProductName() {
802807

803808
@Test
804809
public void canUseDirectPath_isNotOnComputeEngine_unableToGetSystemProductName() {
810+
System.setProperty("os.name", "Linux");
805811
EnvironmentProvider envProvider = Mockito.mock(EnvironmentProvider.class);
806812
Mockito.when(
807813
envProvider.getenv(
@@ -819,6 +825,7 @@ public void canUseDirectPath_isNotOnComputeEngine_unableToGetSystemProductName()
819825

820826
@Test
821827
public void canUseDirectPath_nonGDUUniverseDomain() {
828+
System.setProperty("os.name", "Linux");
822829
EnvironmentProvider envProvider = Mockito.mock(EnvironmentProvider.class);
823830
Mockito.when(
824831
envProvider.getenv(

0 commit comments

Comments
 (0)