From 76196d5fa10785d72a69356946f2a5756f6e3bc2 Mon Sep 17 00:00:00 2001 From: Gokhan Gulbiz Date: Mon, 21 Aug 2023 11:14:40 +0300 Subject: [PATCH] test-flakyness --- .github/workflows/build_and_test.yml | 61 ++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 685770026..2c02db03a 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -392,3 +392,64 @@ jobs: cd ./src/test/hammerdb chmod +x run_hammerdb.sh run_hammerdb.sh citusbot_tpcc_benchmark_rg + test-flakyness-pre: + name: Detect regression tests need to be ran + runs-on: ubuntu-latest + outputs: + tests: ${{ steps.detect-regression-tests.outputs.tests }} + steps: + - uses: actions/checkout@v3.5.0 + - name: Detect regression tests need to be ran + id: detect-regression-tests + run: |- + detected_changes=$(git diff origin/main... --name-only --diff-filter=AM | (grep 'src/test/regress/sql/.*\.sql\|src/test/regress/spec/.*\.spec\|src/test/regress/citus_tests/test/test_.*\.py' || true)) + tests=${detected_changes} + if [ -z "$tests" ]; then + echo "No test found." + else + echo "Detected tests " $tests + fi + echo tests=\""$tests"\" >> "$GITHUB_OUTPUT" + prepare_parallelization_matrix_32: + name: Prepare parallelization matrix + if: ${{ needs.test-flakyness-pre.outputs.tests != ''}} + needs: test-flakyness-pre + runs-on: ubuntu-latest + outputs: + json: ${{ steps.parallelization.outputs.json }} + steps: + - uses: actions/checkout@v3.5.0 + - uses: "./.github/actions/parallelization" + id: parallelization + with: + count: 32 + test-flakyness: + if: ${{ needs.test-flakyness-pre.outputs.tests != ''}} + name: Runs a test multiple times to see if it's flaky + runs-on: ubuntu-latest + container: + image: ${{ inputs.fail_test_image_name }} + options: --user root + env: + runs: 8 + needs: + - build + - test-flakyness-pre + - prepare_parallelization_matrix_32 + strategy: + fail-fast: false + matrix: ${{ fromJson(needs.prepare_parallelization_matrix_32.outputs.json) }} + steps: + - uses: actions/checkout@v3.5.0 + - uses: actions/download-artifact@v3.0.1 + - uses: "./.github/actions/install_extension" + - name: Run minimal tests + run: |- + tests=${{ needs.test-flakyness-pre.outputs.tests }} + tests_array=($tests) + for test in "${tests_array[@]}" + do + test_name=$(echo "$test" | sed -r "s/.+\/(.+)\..+/\1/") + gosu circleci src/test/regress/citus_tests/run_test.py $test_name --repeat ${{ env.runs }} --use-base-schedule --use-whole-schedule-line + done + - uses: "./.github/actions/save_logs_and_results"