From eafcc695292aafd569481f439de28d26a2dfc473 Mon Sep 17 00:00:00 2001 From: Adam Kolodziejczyk Date: Fri, 19 Jul 2024 09:46:19 +0200 Subject: [PATCH] temporary disable proxy tests on github actions mac --- .github/workflows/build-test.yml | 4 ---- .../client/RunningNotOnGithubActionsMac.java | 16 ++++++++++++++++ .../net/snowflake/client/jdbc/ProxyLatestIT.java | 8 ++++++-- 3 files changed, 22 insertions(+), 6 deletions(-) create mode 100644 src/test/java/net/snowflake/client/RunningNotOnGithubActionsMac.java diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 7e69faa02..190425de4 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -86,10 +86,6 @@ jobs: - uses: actions/setup-python@v4 with: python-version: '3.7' - - name: 'localhost access workaround' - run: | - echo -e "127.0.0.1 $(hostname -f) $(hostname -s)" | sudo tee -a /etc/hosts - echo -e "" | sudo tee -a /etc/hosts - name: Install Homebrew Bash shell: bash run: brew install bash diff --git a/src/test/java/net/snowflake/client/RunningNotOnGithubActionsMac.java b/src/test/java/net/snowflake/client/RunningNotOnGithubActionsMac.java new file mode 100644 index 000000000..02cec7c8f --- /dev/null +++ b/src/test/java/net/snowflake/client/RunningNotOnGithubActionsMac.java @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2012-2019 Snowflake Computing Inc. All right reserved. + */ +package net.snowflake.client; + +import net.snowflake.client.core.Constants; + +public class RunningNotOnGithubActionsMac implements ConditionalIgnoreRule.IgnoreCondition { + public boolean isSatisfied() { + return TestUtil.systemGetEnv("GITHUB_ACTIONS") != null && Constants.getOS() == Constants.OS.MAC; + } + + public static boolean isRunningOnGithubActionsMac() { + return TestUtil.systemGetEnv("GITHUB_ACTIONS") != null && Constants.getOS() == Constants.OS.MAC; + } +} diff --git a/src/test/java/net/snowflake/client/jdbc/ProxyLatestIT.java b/src/test/java/net/snowflake/client/jdbc/ProxyLatestIT.java index a3b7c04db..df8ac374f 100644 --- a/src/test/java/net/snowflake/client/jdbc/ProxyLatestIT.java +++ b/src/test/java/net/snowflake/client/jdbc/ProxyLatestIT.java @@ -26,6 +26,7 @@ import java.util.Objects; import java.util.Properties; import java.util.logging.Logger; +import net.snowflake.client.RunningNotOnGithubActionsMac; import net.snowflake.client.RunningNotOnJava21; import net.snowflake.client.RunningNotOnJava8; import net.snowflake.client.category.TestCategoryOthers; @@ -54,7 +55,7 @@ public class ProxyLatestIT { private static final String WIREMOCK_FILE_NAME = "wiremock-standalone-3.8.0.jar"; public static final String WIREMOCK_STANDALONE_URL = "https://repo1.maven.org/maven2/org/wiremock/wiremock-standalone/3.8.0/wiremock-standalone-3.8.0.jar"; - private static final String WIREMOCK_HOST = "127.0.0.1"; + private static final String WIREMOCK_HOST = "localhost"; private static final String TRUST_STORE_PROPERTY = "javax.net.ssl.trustStore"; private static int httpProxyPort; private static int httpsProxyPort; @@ -66,6 +67,10 @@ public static void setUpClass() { downloadWiremock(); assumeFalse(RunningNotOnJava8.isRunningOnJava8()); assumeFalse(RunningNotOnJava21.isRunningOnJava21()); + assumeFalse( + RunningNotOnGithubActionsMac + .isRunningOnGithubActionsMac()); // disabled until issue with access to localhost is + // fixed on github actions mac image originalTrustStorePath = systemGetProperty(TRUST_STORE_PROPERTY); } @@ -185,7 +190,6 @@ private void startWiremockStandAlone() { getResourceURL("wiremock" + File.separator + "ca-cert.jks"), "--ca-keystore", getResourceURL("wiremock" + File.separator + "ca-cert.jks")) - .inheritIO() .start(); waitForWiremock(); return true;