From 8b0cd6d4a4ed886c4dd009f845b61be26e0210f2 Mon Sep 17 00:00:00 2001 From: bowenlan-amzn Date: Tue, 3 Oct 2023 10:50:14 -0700 Subject: [PATCH] Parallel test run (#966) * Update test workflows to increase readability Signed-off-by: bowenlan-amzn * Reduce test running time Signed-off-by: bowenlan-amzn * Test if docker logs upload right Signed-off-by: bowenlan-amzn * Dig into several long running test Signed-off-by: bowenlan-amzn * Add back if failure Signed-off-by: bowenlan-amzn * cleanup Signed-off-by: bowenlan-amzn * split by feature Signed-off-by: bowenlan-amzn * debug bwc Signed-off-by: bowenlan-amzn * debug bwc Signed-off-by: bowenlan-amzn * Introduce exclude tests property Signed-off-by: bowenlan-amzn * Setup include exclude test filtering Signed-off-by: bowenlan-amzn * ktlint Signed-off-by: bowenlan-amzn --------- Signed-off-by: bowenlan-amzn --- .github/workflows/multi-node-test-workflow.yml | 13 ++++++++++++- .github/workflows/test-and-build-workflow.yml | 8 +++++++- build.gradle | 15 +++++++++++++++ 3 files changed, 34 insertions(+), 2 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 682342310..af9ba6e5a 100644 --- a/.github/workflows/test-and-build-workflow.yml +++ b/.github/workflows/test-and-build-workflow.yml @@ -12,6 +12,7 @@ jobs: env: BUILD_ARGS: ${{ matrix.os_build_args }} WORKING_DIR: ${{ matrix.working_directory }}. + TEST_FILTER: ${{ matrix.test_filter }} strategy: # This setting says that all jobs should finish, even if one fails fail-fast: false @@ -19,6 +20,7 @@ jobs: matrix: java: [11, 17] os: [ubuntu-latest, windows-latest, macos-latest] + feature: [ism, non-ism] include: - os: windows-latest os_build_args: -x integTest -x jacocoTestReport @@ -26,6 +28,10 @@ jobs: os_java_options: -Xmx4096M - os: macos-latest os_build_args: -x integTest -x jacocoTestReport + - feature: ism + 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 @@ -44,7 +50,7 @@ jobs: run: subst 'X:' . - name: Build with Gradle working-directory: ${{ env.WORKING_DIR }} - run: ./gradlew build ${{ env.BUILD_ARGS }} + run: ./gradlew build ${{ env.BUILD_ARGS }} ${{ env.TEST_FILTER }} env: _JAVA_OPTIONS: ${{ matrix.os_java_options }} - name: Upload failed logs diff --git a/build.gradle b/build.gradle index 2c59abfd5..58917eb2a 100644 --- a/build.gradle +++ b/build.gradle @@ -574,6 +574,21 @@ integTest { if (usingRemoteCluster) { exclude 'org/opensearch/indexmanagement/controlcenter/notification/filter/NotificationActionListenerIT.class' } + + if (project.hasProperty('includeTests')) { + String includeTests = project.property('includeTests') + println("Include tests ${includeTests}") + filter { + includeTestsMatching includeTests + } + } + if (project.hasProperty('excludeTests')) { + String excludeTests = project.property('excludeTests') + println("Exclude tests ${excludeTests}") + filter { + excludeTestsMatching excludeTests + } + } } task integTestRemote(type: RestIntegTestTask) {