Skip to content

Commit

Permalink
[Tests] Disable test retries for new or modified tests (apache#14607)
Browse files Browse the repository at this point in the history
### Motivation

There's a [discussion on the mailing about improving unit test stability](https://lists.apache.org/thread/d4tq105wmsmm3s84lwy19d0b6hbxn7vz). 
One of the methods is to disable test retries for new or modified test classes. This will reduce the likelihood of introducing more flaky tests into the code base.

### Modifications

- Use the paths-filter in GitHub Actions to list test class changes. Use GitHub Actions to place the CSV list to a environment variable called `CHANGED_TESTS`.
- parse `CHANGED_TESTS` in RetryAnalyzer which determines whether a failed test method should be retried or not. Disable test retries for new or modified tests.
- parse `CHANGED_TESTS` in `build/retry.sh` script. Skip retries if there's a test failure in one of the changed tests.
  • Loading branch information
lhotari authored Mar 9, 2022
1 parent 519dd6e commit 98b4492
Show file tree
Hide file tree
Showing 33 changed files with 101 additions and 27 deletions.
2 changes: 2 additions & 0 deletions .github/changes-filter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ docs:
- '.asf.yaml'
- '*.md'
- '**/*.md'
tests:
- added|modified: '**/src/test/java/**/*.java'
1 change: 1 addition & 0 deletions .github/workflows/ci-build-macos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ jobs:
uses: apache/pulsar-test-infra/paths-filter@master
with:
filters: .github/changes-filter.yaml
list-files: csv

- name: Check changed files
id: check_changes
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ci-cpp-build-centos7.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ jobs:
uses: apache/pulsar-test-infra/paths-filter@master
with:
filters: .github/changes-filter.yaml
list-files: csv

- name: Check changed files
id: check_changes
Expand All @@ -59,4 +60,4 @@ jobs:
if: ${{ steps.check_changes.outputs.docs_only != 'true' }}
run: |
echo "Build C++ client library on CentOS 7"
pulsar-client-cpp/docker-build-centos7.sh
pulsar-client-cpp/docker-build-centos7.sh
1 change: 1 addition & 0 deletions .github/workflows/ci-cpp-build-windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ jobs:
uses: apache/pulsar-test-infra/paths-filter@master
with:
filters: .github/changes-filter.yaml
list-files: csv

- name: Check changed files
id: check_changes
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci-cpp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ jobs:
uses: apache/pulsar-test-infra/paths-filter@master
with:
filters: .github/changes-filter.yaml
list-files: csv

- name: Check changed files
id: check_changes
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci-go-functions-style.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ jobs:
uses: apache/pulsar-test-infra/paths-filter@master
with:
filters: .github/changes-filter.yaml
list-files: csv

- name: Check changed files
id: check_changes
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci-go-functions-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ jobs:
uses: apache/pulsar-test-infra/paths-filter@master
with:
filters: .github/changes-filter.yaml
list-files: csv

- name: Check changed files
id: check_changes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ jobs:
uses: apache/pulsar-test-infra/paths-filter@master
with:
filters: .github/changes-filter.yaml
list-files: csv

- name: Check changed files
id: check_changes
Expand Down Expand Up @@ -99,7 +100,7 @@ jobs:

- name: run integration tests
if: ${{ steps.check_changes.outputs.docs_only != 'true' }}
run: ./build/run_integration_group.sh BACKWARDS_COMPAT
run: CHANGED_TESTS="${{ steps.changes.outputs.tests_files }}" ./build/run_integration_group.sh BACKWARDS_COMPAT

- name: Upload container logs
uses: actions/upload-artifact@v2
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ci-integration-cli.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ jobs:
uses: apache/pulsar-test-infra/paths-filter@master
with:
filters: .github/changes-filter.yaml
list-files: csv

- name: Check changed files
id: check_changes
Expand Down Expand Up @@ -99,7 +100,7 @@ jobs:

- name: run integration tests
if: ${{ steps.check_changes.outputs.docs_only != 'true' }}
run: ./build/run_integration_group.sh CLI
run: CHANGED_TESTS="${{ steps.changes.outputs.tests_files }}" ./build/run_integration_group.sh CLI

- name: Upload container logs
uses: actions/upload-artifact@v2
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ci-integration-function.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ jobs:
uses: apache/pulsar-test-infra/paths-filter@master
with:
filters: .github/changes-filter.yaml
list-files: csv

- name: Check changed files
id: check_changes
Expand Down Expand Up @@ -99,7 +100,7 @@ jobs:

- name: run integration tests
if: ${{ steps.check_changes.outputs.docs_only != 'true' }}
run: ./build/run_integration_group.sh FUNCTION
run: CHANGED_TESTS="${{ steps.changes.outputs.tests_files }}" ./build/run_integration_group.sh FUNCTION

- name: Upload container logs
uses: actions/upload-artifact@v2
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ci-integration-messaging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ jobs:
uses: apache/pulsar-test-infra/paths-filter@master
with:
filters: .github/changes-filter.yaml
list-files: csv

- name: Check changed files
id: check_changes
Expand Down Expand Up @@ -99,7 +100,7 @@ jobs:

- name: run integration tests
if: ${{ steps.check_changes.outputs.docs_only != 'true' }}
run: ./build/run_integration_group.sh MESSAGING
run: CHANGED_TESTS="${{ steps.changes.outputs.tests_files }}" ./build/run_integration_group.sh MESSAGING

- name: Upload container logs
uses: actions/upload-artifact@v2
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ci-integration-process.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ jobs:
uses: apache/pulsar-test-infra/paths-filter@master
with:
filters: .github/changes-filter.yaml
list-files: csv

- name: Check changed files
id: check_changes
Expand Down Expand Up @@ -98,7 +99,7 @@ jobs:

- name: run integration tests
if: ${{ steps.check_changes.outputs.docs_only != 'true' }}
run: ./build/run_integration_group.sh PULSAR_CONNECTORS_PROCESS
run: CHANGED_TESTS="${{ steps.changes.outputs.tests_files }}" ./build/run_integration_group.sh PULSAR_CONNECTORS_PROCESS

- name: Log dmesg when failed
if: ${{ failure() }}
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ci-integration-pulsar-io-ora.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ jobs:
uses: apache/pulsar-test-infra/paths-filter@master
with:
filters: .github/changes-filter.yaml
list-files: csv

- name: Check changed files
id: check_changes
Expand Down Expand Up @@ -100,7 +101,7 @@ jobs:

- name: run integration tests
if: ${{ steps.check_changes.outputs.docs_only != 'true' }}
run: ./build/run_integration_group.sh PULSAR_IO_ORA
run: CHANGED_TESTS="${{ steps.changes.outputs.tests_files }}" ./build/run_integration_group.sh PULSAR_IO_ORA

- name: Upload container logs
uses: actions/upload-artifact@v2
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ci-integration-pulsar-io.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ jobs:
uses: apache/pulsar-test-infra/paths-filter@master
with:
filters: .github/changes-filter.yaml
list-files: csv

- name: Check changed files
id: check_changes
Expand Down Expand Up @@ -100,7 +101,7 @@ jobs:

- name: run integration tests
if: ${{ steps.check_changes.outputs.docs_only != 'true' }}
run: ./build/run_integration_group.sh PULSAR_IO
run: CHANGED_TESTS="${{ steps.changes.outputs.tests_files }}" ./build/run_integration_group.sh PULSAR_IO

- name: Upload container logs
uses: actions/upload-artifact@v2
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ci-integration-schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ jobs:
uses: apache/pulsar-test-infra/paths-filter@master
with:
filters: .github/changes-filter.yaml
list-files: csv

- name: Check changed files
id: check_changes
Expand Down Expand Up @@ -95,7 +96,7 @@ jobs:

- name: run integration tests
if: ${{ steps.check_changes.outputs.docs_only != 'true' }}
run: ./build/run_integration_group.sh SCHEMA
run: CHANGED_TESTS="${{ steps.changes.outputs.tests_files }}" ./build/run_integration_group.sh SCHEMA

- name: Upload container logs
uses: actions/upload-artifact@v2
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ci-integration-sql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ jobs:
uses: apache/pulsar-test-infra/paths-filter@master
with:
filters: .github/changes-filter.yaml
list-files: csv

- name: Check changed files
id: check_changes
Expand Down Expand Up @@ -99,7 +100,7 @@ jobs:

- name: run integration tests
if: ${{ steps.check_changes.outputs.docs_only != 'true' }}
run: ./build/run_integration_group.sh SQL
run: CHANGED_TESTS="${{ steps.changes.outputs.tests_files }}" ./build/run_integration_group.sh SQL

- name: Log dmesg when failed
if: ${{ failure() }}
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ci-integration-standalone.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ jobs:
uses: apache/pulsar-test-infra/paths-filter@master
with:
filters: .github/changes-filter.yaml
list-files: csv

- name: Check changed files
id: check_changes
Expand Down Expand Up @@ -98,7 +99,7 @@ jobs:

- name: run integration tests
if: ${{ steps.check_changes.outputs.docs_only != 'true' }}
run: ./build/run_integration_group.sh STANDALONE
run: CHANGED_TESTS="${{ steps.changes.outputs.tests_files }}" ./build/run_integration_group.sh STANDALONE

- name: Upload container logs
uses: actions/upload-artifact@v2
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ci-integration-thread.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ jobs:
uses: apache/pulsar-test-infra/paths-filter@master
with:
filters: .github/changes-filter.yaml
list-files: csv

- name: Check changed files
id: check_changes
Expand Down Expand Up @@ -98,7 +99,7 @@ jobs:

- name: run integration function
if: ${{ steps.check_changes.outputs.docs_only != 'true' }}
run: ./build/run_integration_group.sh PULSAR_CONNECTORS_THREAD
run: CHANGED_TESTS="${{ steps.changes.outputs.tests_files }}" ./build/run_integration_group.sh PULSAR_CONNECTORS_THREAD

- name: Upload container logs
uses: actions/upload-artifact@v2
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ci-integration-tiered-filesystem.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ jobs:
uses: apache/pulsar-test-infra/paths-filter@master
with:
filters: .github/changes-filter.yaml
list-files: csv

- name: Check changed files
id: check_changes
Expand Down Expand Up @@ -98,7 +99,7 @@ jobs:

- name: run integration tests
if: ${{ steps.check_changes.outputs.docs_only != 'true' }}
run: ./build/run_integration_group.sh TIERED_FILESYSTEM
run: CHANGED_TESTS="${{ steps.changes.outputs.tests_files }}" ./build/run_integration_group.sh TIERED_FILESYSTEM

- name: Upload container logs
uses: actions/upload-artifact@v2
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ci-integration-tiered-jcloud.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ jobs:
uses: apache/pulsar-test-infra/paths-filter@master
with:
filters: .github/changes-filter.yaml
list-files: csv

- name: Check changed files
id: check_changes
Expand Down Expand Up @@ -98,7 +99,7 @@ jobs:

- name: run integration tests
if: ${{ steps.check_changes.outputs.docs_only != 'true' }}
run: ./build/run_integration_group.sh TIERED_JCLOUD
run: CHANGED_TESTS="${{ steps.changes.outputs.tests_files }}" ./build/run_integration_group.sh TIERED_JCLOUD

- name: Upload container logs
uses: actions/upload-artifact@v2
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ci-integration-transaction.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ jobs:
uses: apache/pulsar-test-infra/paths-filter@master
with:
filters: .github/changes-filter.yaml
list-files: csv

- name: Check changed files
id: check_changes
Expand Down Expand Up @@ -95,7 +96,7 @@ jobs:

- name: run integration tests
if: ${{ steps.check_changes.outputs.docs_only != 'true' }}
run: ./build/run_integration_group.sh TRANSACTION
run: CHANGED_TESTS="${{ steps.changes.outputs.tests_files }}" ./build/run_integration_group.sh TRANSACTION

- name: Upload container logs
uses: actions/upload-artifact@v2
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci-license.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ jobs:
uses: apache/pulsar-test-infra/paths-filter@master
with:
filters: .github/changes-filter.yaml
list-files: csv

- name: Check changed files
id: check_changes
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ci-python-build-3.9-client.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ jobs:
uses: apache/pulsar-test-infra/paths-filter@master
with:
filters: .github/changes-filter.yaml
list-files: csv

- name: Check changed files
id: check_changes
Expand All @@ -59,4 +60,4 @@ jobs:
if: ${{ steps.check_changes.outputs.docs_only != 'true' }}
run: |
echo "Build Python3.9 client library"
pulsar-client-cpp/docker-build-python3.9.sh
pulsar-client-cpp/docker-build-python3.9.sh
3 changes: 2 additions & 1 deletion .github/workflows/ci-shade-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ jobs:
uses: apache/pulsar-test-infra/paths-filter@master
with:
filters: .github/changes-filter.yaml
list-files: csv

- name: Check changed files
id: check_changes
Expand Down Expand Up @@ -99,4 +100,4 @@ jobs:

- name: run shade tests
if: ${{ steps.check_changes.outputs.docs_only != 'true' }}
run: ./build/run_integration_group.sh SHADE
run: CHANGED_TESTS="${{ steps.changes.outputs.tests_files }}" ./build/run_integration_group.sh SHADE
7 changes: 4 additions & 3 deletions .github/workflows/ci-unit-broker-broker-gp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ jobs:
uses: apache/pulsar-test-infra/paths-filter@master
with:
filters: .github/changes-filter.yaml
list-files: csv

- name: Check changed files
id: check_changes
Expand Down Expand Up @@ -81,15 +82,15 @@ jobs:

- name: run unit test 'BROKER_GROUP_1'
if: ${{ steps.check_changes.outputs.docs_only != 'true' && matrix.group == 'group1' }}
run: ./build/run_unit_group.sh BROKER_GROUP_1
run: CHANGED_TESTS="${{ steps.changes.outputs.tests_files }}" ./build/run_unit_group.sh BROKER_GROUP_1

- name: run unit test 'BROKER_GROUP_2'
if: ${{ steps.check_changes.outputs.docs_only != 'true' && matrix.group == 'group2' }}
run: ./build/run_unit_group.sh BROKER_GROUP_2
run: CHANGED_TESTS="${{ steps.changes.outputs.tests_files }}" ./build/run_unit_group.sh BROKER_GROUP_2

- name: run unit test 'BROKER_GROUP_3'
if: ${{ steps.check_changes.outputs.docs_only != 'true' && matrix.group == 'group3' }}
run: ./build/run_unit_group.sh BROKER_GROUP_3
run: CHANGED_TESTS="${{ steps.changes.outputs.tests_files }}" ./build/run_unit_group.sh BROKER_GROUP_3

- name: print JVM thread dumps when cancelled
if: cancelled()
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ci-unit-broker-client-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ jobs:
uses: apache/pulsar-test-infra/paths-filter@master
with:
filters: .github/changes-filter.yaml
list-files: csv

- name: Check changed files
id: check_changes
Expand Down Expand Up @@ -77,7 +78,7 @@ jobs:

- name: run unit test 'BROKER_CLIENT_API'
if: ${{ steps.check_changes.outputs.docs_only != 'true' }}
run: ./build/run_unit_group.sh BROKER_CLIENT_API
run: CHANGED_TESTS="${{ steps.changes.outputs.tests_files }}" ./build/run_unit_group.sh BROKER_CLIENT_API

- name: print JVM thread dumps when cancelled
if: cancelled()
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ci-unit-broker-client-impl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ jobs:
uses: apache/pulsar-test-infra/paths-filter@master
with:
filters: .github/changes-filter.yaml
list-files: csv

- name: Check changed files
id: check_changes
Expand Down Expand Up @@ -77,7 +78,7 @@ jobs:

- name: run unit test 'BROKER_CLIENT_IMPL'
if: ${{ steps.check_changes.outputs.docs_only != 'true' }}
run: ./build/run_unit_group.sh BROKER_CLIENT_IMPL
run: CHANGED_TESTS="${{ steps.changes.outputs.tests_files }}" ./build/run_unit_group.sh BROKER_CLIENT_IMPL

- name: print JVM thread dumps when cancelled
if: cancelled()
Expand Down
Loading

0 comments on commit 98b4492

Please sign in to comment.