From 719630ad7c39168ad8f6fbbbe33839a146c24ca5 Mon Sep 17 00:00:00 2001 From: bowenlan-amzn Date: Sun, 1 Oct 2023 10:59:11 -0700 Subject: [PATCH] Setup include exclude test filtering Signed-off-by: bowenlan-amzn --- .github/workflows/multi-node-test-workflow.yml | 13 ++++++++++++- .github/workflows/test-and-build-workflow.yml | 4 +++- build.gradle | 12 ++++++++++-- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/.github/workflows/multi-node-test-workflow.yml b/.github/workflows/multi-node-test-workflow.yml index c4eb6cb76..c473a5604 100644 --- a/.github/workflows/multi-node-test-workflow.yml +++ b/.github/workflows/multi-node-test-workflow.yml @@ -10,6 +10,17 @@ on: jobs: multi-node-test: + env: + TEST_FILTER: ${{ matrix.test_filter }} + strategy: + fail-fast: false + matrix: + feature: [ism, non-ism] + include: + - feature: ism + test_filter: -PincludeTests="org.opensearch.indexmanagement.indexstatemanagement*" + - feature: non-ism + test_filter: -PexcludeTests="org.opensearch.indexmanagement.indexstatemanagement*" # This job runs on Linux runs-on: ubuntu-latest steps: @@ -23,7 +34,7 @@ jobs: - name: Checkout Branch uses: actions/checkout@v2 - name: Run integration tests with multi node config - run: ./gradlew integTest -PnumNodes=3 + run: ./gradlew integTest -PnumNodes=3 ${{ env.TEST_FILTER }} - name: Upload failed logs uses: actions/upload-artifact@v2 if: failure() diff --git a/.github/workflows/test-and-build-workflow.yml b/.github/workflows/test-and-build-workflow.yml index 037a60f69..af9ba6e5a 100644 --- a/.github/workflows/test-and-build-workflow.yml +++ b/.github/workflows/test-and-build-workflow.yml @@ -29,7 +29,9 @@ jobs: - os: macos-latest os_build_args: -x integTest -x jacocoTestReport - feature: ism - test_filter: --tests "org.opensearch.indexmanagement.indexstatemanagement*" + test_filter: -PincludeTests="org.opensearch.indexmanagement.indexstatemanagement*" + - feature: non-ism + test_filter: -PexcludeTests="org.opensearch.indexmanagement.indexstatemanagement*" runs-on: ${{ matrix.os }} steps: # This step uses the setup-java Github action: https://github.com/actions/setup-java diff --git a/build.gradle b/build.gradle index 8835dbd78..58917eb2a 100644 --- a/build.gradle +++ b/build.gradle @@ -576,10 +576,18 @@ integTest { } if (project.hasProperty('includeTests')) { - exclude "${project.property('includeTests')}" + String includeTests = project.property('includeTests') + println("Include tests ${includeTests}") + filter { + includeTestsMatching includeTests + } } if (project.hasProperty('excludeTests')) { - exclude "${project.property('excludeTests')}" + String excludeTests = project.property('excludeTests') + println("Exclude tests ${excludeTests}") + filter { + excludeTestsMatching excludeTests + } } }