Skip to content

Commit

Permalink
Setup include exclude test filtering
Browse files Browse the repository at this point in the history
Signed-off-by: bowenlan-amzn <[email protected]>
  • Loading branch information
bowenlan-amzn committed Oct 1, 2023
1 parent fc2ce92 commit 719630a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
13 changes: 12 additions & 1 deletion .github/workflows/multi-node-test-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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()
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/test-and-build-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 10 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}

Expand Down

0 comments on commit 719630a

Please sign in to comment.