diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 3883a1a9..b4259322 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -1,6 +1,9 @@ name: PR CI Checks -on: [pull_request] +on: + pull_request: + push: + branches: [ "v3" ] jobs: check-commit-message: @@ -15,14 +18,16 @@ jobs: excludeDescription: "true" checkAllCommitMessages: "true" accessToken: ${{ secrets.PAT_ACTIONS }} - error: "One of your your commit messages is not matching the format with JIRA ID Ex: ( SDK-123 commit message )" + error: "One of your commit messages is not matching the format with JIRA ID Ex: ( SDK-123 commit message )" + Test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 + - uses: actions/setup-java@v1 with: - java-version: "1.8" + java-version: "11" - name: create-json id: create-json @@ -34,18 +39,21 @@ jobs: - name: create env id: create-env run: | - touch .env - echo SKYFLOW_CREDENTIALS=${{ secrets.SKYFLOW_CREDENTIALS }} >> .env - echo TEST_EXPIRED_TOKEN=${{ secrets.TEST_EXPIRED_TOKEN }} >> .env - echo TEST_REUSABLE_TOKEN=${{ secrets.TEST_REUSABLE_TOKEN }} >> .env + touch v3/.env + echo SKYFLOW_CREDENTIALS=${{ secrets.SKYFLOW_CREDENTIALS }} >> v3/.env + echo TEST_EXPIRED_TOKEN=${{ secrets.TEST_EXPIRED_TOKEN }} >> v3/.env + echo TEST_REUSABLE_TOKEN=${{ secrets.TEST_REUSABLE_TOKEN }} >> v3/.env - name: Build & Run tests with Maven - run: mvn -B package -f pom.xml -Dmaven.javadoc.skip=true + run: mvn -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn clean test jacoco:report -pl v3 -am -Dmaven.javadoc.skip=true - name: Codecov - uses: codecov/codecov-action@v2.1.0 + uses: codecov/codecov-action@v3 with: token: ${{ secrets.CODECOV_REPO_UPLOAD_TOKEN }} - files: target/site/jacoco/jacoco.xml + files: v3/target/site/jacoco/jacoco.xml + flags: unittests + name: codecov-skyflow-java - verbose: true + fail_ci_if_error: true + verbose: true \ No newline at end of file diff --git a/pom.xml b/pom.xml index e94e5f2e..611ce4e6 100644 --- a/pom.xml +++ b/pom.xml @@ -126,7 +126,7 @@ junit junit - ${junit-version} + 4.13.2 test @@ -141,12 +141,6 @@ 2.0.9 test - - org.junit.jupiter - junit-jupiter - 5.13.2 - compile - diff --git a/v3/src/test/java/com/skyflow/VaultClientTests.java b/v3/src/test/java/com/skyflow/VaultClientTests.java index f91b5b44..c9aaa82c 100644 --- a/v3/src/test/java/com/skyflow/VaultClientTests.java +++ b/v3/src/test/java/com/skyflow/VaultClientTests.java @@ -116,7 +116,10 @@ public void testSetBearerTokenWithEnvCredentials() { vaultClient.setBearerToken(); // Credentials at ENV level should be prioritised - Assert.assertEquals(credentials, getPrivateField(vaultClient, "finalCredentials")); + Assert.assertEquals( + credentials.getCredentialsString(), + ((Credentials) getPrivateField(vaultClient, "finalCredentials")).getCredentialsString() + ); } catch (SkyflowException e) { Assert.assertEquals(ErrorCode.INVALID_INPUT.getCode(), 400); @@ -278,4 +281,4 @@ private Object getPrivateField(Object obj, String fieldName) throws Exception { return field.get(obj); } -} +} \ No newline at end of file diff --git a/v3/src/test/java/com/skyflow/utils/UtilsTests.java b/v3/src/test/java/com/skyflow/utils/UtilsTests.java index 9d2e237f..a2cd8b1b 100644 --- a/v3/src/test/java/com/skyflow/utils/UtilsTests.java +++ b/v3/src/test/java/com/skyflow/utils/UtilsTests.java @@ -18,7 +18,7 @@ import java.util.*; -import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.Assert.assertEquals; public class UtilsTests { private static final String INVALID_EXCEPTION_THROWN = "Should not have thrown any exception"; @@ -990,4 +990,4 @@ public void testHandleBatchExceptionWithApiClientApiExceptionCause() { Assert.assertEquals(400, errors.get(0).getCode()); } -} \ No newline at end of file +} diff --git a/v3/src/test/java/com/skyflow/vault/controller/VaultControllerTests.java b/v3/src/test/java/com/skyflow/vault/controller/VaultControllerTests.java index f11f6c0f..7c90d1f6 100644 --- a/v3/src/test/java/com/skyflow/vault/controller/VaultControllerTests.java +++ b/v3/src/test/java/com/skyflow/vault/controller/VaultControllerTests.java @@ -25,7 +25,12 @@ import static org.junit.Assert.*; +import org.junit.runner.RunWith; +import org.powermock.core.classloader.annotations.PowerMockIgnore; // Import this +import org.powermock.modules.junit4.PowerMockRunner; +@RunWith(PowerMockRunner.class) +@PowerMockIgnore({"javax.management.*", "java.nio.*", "com.sun.*", "jdk.internal.reflect.*", "javax.crypto.*"}) public class VaultControllerTests { private static final String ENV_PATH = "./.env";