From c08ea0526acce2ea106712177f85b4ad3442a677 Mon Sep 17 00:00:00 2001 From: Daniel Widdis Date: Fri, 27 Dec 2024 11:35:00 -0800 Subject: [PATCH] Fix some CI Signed-off-by: Daniel Widdis --- .github/workflows/CI.yml | 34 +++++++++++++++++++ .github/workflows/test_bwc.yml | 16 +++++++++ .github/workflows/test_security.yml | 16 +++++++++ .../flowframework/util/EncryptorUtils.java | 2 +- .../FlowFrameworkTenantAwareRestTestCase.java | 4 +-- .../rest/RestWorkflowTenantAwareIT.java | 1 + 6 files changed, 70 insertions(+), 3 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 3f025add7..6f9efe187 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -158,4 +158,38 @@ jobs: - name: Build and Run Tests run: | ./gradlew integTest -PnumNodes=3 + integTenantAwareTest: + needs: [spotless, javadoc] + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + java: [21] + name: Multi-Node Integ Test JDK${{ matrix.java }}, ${{ matrix.os }} + runs-on: ${{ matrix.os }} + steps: + # TEMPORARY until this is on Maven + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + java-version: 21 + distribution: temurin + - name: Checkout Metadata Client + uses: actions/checkout@v4 + with: + repository: dbwiddis/opensearch-remote-metadata-sdk + ref: main + path: opensearch-remote-metadata-sdk + - name: Publish to maven local + working-directory: opensearch-remote-metadata-sdk + run: ./gradlew publishToMavenLocal + # end TEMPORARY code + - uses: actions/checkout@v4 + - name: Set up JDK ${{ matrix.java }} + uses: actions/setup-java@v4 + with: + java-version: ${{ matrix.java }} + distribution: temurin + - name: Build and Run Tests + run: | ./gradlew integTest -PnumNodes=3 -Dtests.rest.tenantaware=true diff --git a/.github/workflows/test_bwc.yml b/.github/workflows/test_bwc.yml index d5b31b7a5..247b0b184 100644 --- a/.github/workflows/test_bwc.yml +++ b/.github/workflows/test_bwc.yml @@ -20,6 +20,22 @@ jobs: runs-on: ubuntu-latest steps: + # TEMPORARY until this is on Maven + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + java-version: 21 + distribution: temurin + - name: Checkout Metadata Client + uses: actions/checkout@v4 + with: + repository: dbwiddis/opensearch-remote-metadata-sdk + ref: main + path: opensearch-remote-metadata-sdk + - name: Publish to maven local + working-directory: opensearch-remote-metadata-sdk + run: ./gradlew publishToMavenLocal + # end TEMPORARY code - name: Setup Java ${{ matrix.java }} uses: actions/setup-java@v4 with: diff --git a/.github/workflows/test_security.yml b/.github/workflows/test_security.yml index d3db98a00..9b36146c5 100644 --- a/.github/workflows/test_security.yml +++ b/.github/workflows/test_security.yml @@ -34,6 +34,22 @@ jobs: options: --user root steps: + # TEMPORARY until this is on Maven + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + java-version: 21 + distribution: temurin + - name: Checkout Metadata Client + uses: actions/checkout@v4 + with: + repository: dbwiddis/opensearch-remote-metadata-sdk + ref: main + path: opensearch-remote-metadata-sdk + - name: Publish to maven local + working-directory: opensearch-remote-metadata-sdk + run: ./gradlew publishToMavenLocal + # end TEMPORARY code - name: Checkout Flow Framework uses: actions/checkout@v3 - name: Setup Java ${{ matrix.java }} diff --git a/src/main/java/org/opensearch/flowframework/util/EncryptorUtils.java b/src/main/java/org/opensearch/flowframework/util/EncryptorUtils.java index c660b76e6..51a301759 100644 --- a/src/main/java/org/opensearch/flowframework/util/EncryptorUtils.java +++ b/src/main/java/org/opensearch/flowframework/util/EncryptorUtils.java @@ -420,7 +420,7 @@ private String hashString(String input) { MessageDigest digest = MessageDigest.getInstance("SHA-256"); // Perform the hashing and get the byte array - byte[] hashBytes = digest.digest(input.getBytes()); + byte[] hashBytes = digest.digest(input.getBytes(StandardCharsets.UTF_8)); // Convert the byte array to a Base64 encoded string return Base64.getUrlEncoder().encodeToString(hashBytes); diff --git a/src/test/java/org/opensearch/flowframework/FlowFrameworkTenantAwareRestTestCase.java b/src/test/java/org/opensearch/flowframework/FlowFrameworkTenantAwareRestTestCase.java index 72126c8d5..c76ba6bb0 100644 --- a/src/test/java/org/opensearch/flowframework/FlowFrameworkTenantAwareRestTestCase.java +++ b/src/test/java/org/opensearch/flowframework/FlowFrameworkTenantAwareRestTestCase.java @@ -33,8 +33,8 @@ import static java.util.Collections.emptyMap; import static java.util.Collections.singletonList; import static org.opensearch.common.xcontent.XContentType.JSON; -import static org.opensearch.flowframework.common.CommonValue.*; -import static org.opensearch.flowframework.common.FlowFrameworkSettings.*; +import static org.opensearch.flowframework.common.CommonValue.TENANT_ID_HEADER; +import static org.opensearch.flowframework.common.FlowFrameworkSettings.FLOW_FRAMEWORK_MULTI_TENANCY_ENABLED; public abstract class FlowFrameworkTenantAwareRestTestCase extends FlowFrameworkRestTestCase { diff --git a/src/test/java/org/opensearch/flowframework/rest/RestWorkflowTenantAwareIT.java b/src/test/java/org/opensearch/flowframework/rest/RestWorkflowTenantAwareIT.java index ba9f3383e..5eea23fec 100644 --- a/src/test/java/org/opensearch/flowframework/rest/RestWorkflowTenantAwareIT.java +++ b/src/test/java/org/opensearch/flowframework/rest/RestWorkflowTenantAwareIT.java @@ -46,6 +46,7 @@ public void testWorkflowCRUD() throws Exception { response = makeRequest(tenantRequest, GET, WORKFLOW_PATH + workflowId); assertOK(response); map = responseToMap(response); + logger.error("DEBUG: " + map.toString()); assertEquals("noop", map.get("name")); if (multiTenancyEnabled) { assertEquals(tenantId, map.get(TENANT_ID_FIELD));