From 49e01714cee686a506aa55348d8c161a9421e410 Mon Sep 17 00:00:00 2001 From: Michelangelo Riccobene Date: Sat, 4 May 2024 06:36:20 +0200 Subject: [PATCH] qa-tests: updating test workflow on release/2.60 (#10196) This PR brings the changes of #10195 to the branch release/2.60 with the necessary modifications --- .../qa-clean-exit-block-downloading.yml | 20 ++++++++----- .../qa-clean-exit-snapshot-downloading.yml | 29 +++++++++++-------- .github/workflows/qa-snap-download.yml | 24 ++++++++------- .github/workflows/qa-tip-tracking.yml | 15 ++++++---- 4 files changed, 52 insertions(+), 36 deletions(-) diff --git a/.github/workflows/qa-clean-exit-block-downloading.yml b/.github/workflows/qa-clean-exit-block-downloading.yml index df5115203c3..991ee8387e0 100644 --- a/.github/workflows/qa-clean-exit-block-downloading.yml +++ b/.github/workflows/qa-clean-exit-block-downloading.yml @@ -3,17 +3,19 @@ name: QA - Clean exit (block downloading) on: push: branches: - - 'release/**' + - main + - 'release/2.*' pull_request: branches: - - devel - - 'release/**' + - main + - 'release/2.*' types: - ready_for_review + workflow_dispatch: # Run manually jobs: long-running-test: - runs-on: self-hosted + runs-on: [self-hosted, Erigon2] env: ERIGON_REFERENCE_DATA_DIR: /opt/erigon-versions/reference-version/datadir ERIGON_TESTBED_DATA_DIR: /opt/erigon-testbed/datadir @@ -51,14 +53,15 @@ jobs: # Capture monitoring script exit status test_exit_status=$? + + # Save the subsection reached status + echo "::set-output name=test_executed::true" # Clean up Erigon process if it's still running if kill -0 $ERIGON_PID 2> /dev/null; then echo "Terminating Erigon" kill $ERIGON_PID wait $ERIGON_PID - else - echo "Erigon has already terminated" fi # Check test runner script exit status @@ -71,6 +74,7 @@ jobs: fi - name: Delete Erigon Testbed Data Directory + if: always() run: | rm -rf $ERIGON_TESTBED_DATA_DIR @@ -79,13 +83,13 @@ jobs: python3 $ERIGON_QA_PATH/test_system/db-producer/resume_production.py || true - name: Save test results - if: always() + if: steps.test_step.outputs.test_executed == 'true' env: TEST_RESULT: ${{ steps.test_step.outputs.TEST_RESULT }} run: python3 $ERIGON_QA_PATH/test_system/qa-tests/uploads/upload_test_results.py --repo erigon --commit $(git rev-parse HEAD) --test_name clean-exit-block-downloading --outcome $TEST_RESULT --result_file ${{ github.workspace }}/result.json - name: Upload test results - if: always() + if: steps.test_step.outputs.test_executed == 'true' uses: actions/upload-artifact@v4 with: name: test-results diff --git a/.github/workflows/qa-clean-exit-snapshot-downloading.yml b/.github/workflows/qa-clean-exit-snapshot-downloading.yml index 258032a6428..879432f35d6 100644 --- a/.github/workflows/qa-clean-exit-snapshot-downloading.yml +++ b/.github/workflows/qa-clean-exit-snapshot-downloading.yml @@ -3,14 +3,15 @@ name: QA - Clean exit (snapshot downloading) on: push: branches: - - devel - - 'release/**' + - main + - 'release/2.*' pull_request: branches: - - devel - - 'release/**' + - main + - 'release/2.*' types: - ready_for_review + workflow_dispatch: # Run manually jobs: long-running-test: @@ -24,9 +25,10 @@ jobs: - name: Check out repository uses: actions/checkout@v4 - - name: Clean Erigon Build Directory + - name: Clean Erigon Build & Data Directories run: | make clean + rm -rf $ERIGON_DATA_DIR - name: Build Erigon run: | @@ -48,18 +50,16 @@ jobs: # Capture monitoring script exit status test_exit_status=$? + # Save the subsection reached status + echo "::set-output name=test_executed::true" + # Clean up Erigon process if it's still running if kill -0 $ERIGON_PID 2> /dev/null; then echo "Terminating Erigon" kill $ERIGON_PID wait $ERIGON_PID - else - echo "Erigon has already terminated" fi - # Clean up Erigon build and data directories - rm -rf $ERIGON_DATA_DIR - # Check test runner script exit status if [ $test_exit_status -eq 0 ]; then echo "Tests completed successfully" @@ -69,18 +69,23 @@ jobs: echo "TEST_RESULT=failure" >> "$GITHUB_OUTPUT" fi + - name: Clean up Erigon data directory + if: always() + run: | + rm -rf $ERIGON_DATA_DIR + - name: Resume the Erigon instance dedicated to db maintenance run: | python3 $ERIGON_QA_PATH/test_system/db-producer/resume_production.py || true - name: Save test results - if: always() + if: steps.test_step.outputs.test_executed == 'true' env: TEST_RESULT: ${{ steps.test_step.outputs.TEST_RESULT }} run: python3 $ERIGON_QA_PATH/test_system/qa-tests/uploads/upload_test_results.py --repo erigon --commit $(git rev-parse HEAD) --test_name clean-exit-snapshot-downloading --outcome $TEST_RESULT --result_file ${{ github.workspace }}/result.json - name: Upload test results - if: always() + if: steps.test_step.outputs.test_executed == 'true' uses: actions/upload-artifact@v4 with: name: test-results diff --git a/.github/workflows/qa-snap-download.yml b/.github/workflows/qa-snap-download.yml index 7cdc94d3fb1..4b77b8eb0b9 100644 --- a/.github/workflows/qa-snap-download.yml +++ b/.github/workflows/qa-snap-download.yml @@ -7,7 +7,7 @@ on: jobs: long-running-test: - runs-on: self-hosted + runs-on: [self-hosted, Erigon2] env: ERIGON_DATA_DIR: ${{ github.workspace }}/erigon_data ERIGON_QA_PATH: /home/qarunner/erigon-qa @@ -18,9 +18,10 @@ jobs: - name: Check out repository uses: actions/checkout@v4 - - name: Clean Erigon Build Directory + - name: Clean Erigon Build & Data Directories run: | make clean + rm -rf $ERIGON_DATA_DIR - name: Build Erigon run: | @@ -35,25 +36,23 @@ jobs: id: test_step run: | set +e # Disable exit on error - + # Run Erigon, monitor snapshot downloading and check logs python3 $ERIGON_QA_PATH/test_system/qa-tests/snap-download/run_and_check_snap_download.py ${{ github.workspace }}/build/bin $ERIGON_DATA_DIR $TOTAL_TIME_SECONDS # Capture monitoring script exit status test_exit_status=$? + # Save the subsection reached status + echo "::set-output name=test_executed::true" + # Clean up Erigon process if it's still running if kill -0 $ERIGON_PID 2> /dev/null; then echo "Terminating Erigon" kill $ERIGON_PID wait $ERIGON_PID - else - echo "Erigon has already terminated" fi - # Clean up Erigon build and data directories - rm -rf $ERIGON_DATA_DIR - # Check test runner script exit status if [ $test_exit_status -eq 0 ]; then echo "Tests completed successfully" @@ -63,18 +62,23 @@ jobs: echo "TEST_RESULT=failure" >> "$GITHUB_OUTPUT" fi + - name: Clean up Erigon data directory + if: always() + run: | + rm -rf $ERIGON_DATA_DIR + - name: Resume the Erigon instance dedicated to db maintenance run: | python3 $ERIGON_QA_PATH/test_system/db-producer/resume_production.py || true - name: Save test results - if: always() + if: steps.test_step.outputs.test_executed == 'true' env: TEST_RESULT: ${{ steps.test_step.outputs.TEST_RESULT }} run: python3 $ERIGON_QA_PATH/test_system/qa-tests/uploads/upload_test_results.py --repo erigon --commit $(git rev-parse HEAD) --test_name snap-download --outcome $TEST_RESULT --result_file ${{ github.workspace }}/result.json - name: Upload test results - if: always() + if: steps.test_step.outputs.test_executed == 'true' uses: actions/upload-artifact@v4 with: name: test-results diff --git a/.github/workflows/qa-tip-tracking.yml b/.github/workflows/qa-tip-tracking.yml index 587242ff6e8..4235e3bc9bd 100644 --- a/.github/workflows/qa-tip-tracking.yml +++ b/.github/workflows/qa-tip-tracking.yml @@ -3,10 +3,11 @@ name: QA - Tip tracking on: schedule: - cron: '0 0 * * *' # Run every day at 00:00 AM UTC + workflow_dispatch: # Run manually jobs: long-running-test: - runs-on: self-hosted + runs-on: [self-hosted, Erigon2] env: ERIGON_REFERENCE_DATA_DIR: /opt/erigon-versions/reference-version/datadir ERIGON_TESTBED_DATA_DIR: /opt/erigon-testbed/datadir @@ -29,7 +30,7 @@ jobs: - name: Pause the Erigon instance dedicated to db maintenance run: | - curl -X POST -H "Accept: application/json" -d '{"status": "paused"}' http://localhost:8080/production/default/status || true + python3 $ERIGON_QA_PATH/test_system/db-producer/pause_production.py || true - name: Restore Erigon Testbed Data Directory run: | @@ -48,13 +49,14 @@ jobs: # Capture monitoring script exit status test_exit_status=$? + # Save the subsection reached status + echo "::set-output name=test_executed::true" + # Clean up Erigon process if it's still running if kill -0 $ERIGON_PID 2> /dev/null; then echo "Terminating Erigon" kill $ERIGON_PID wait $ERIGON_PID - else - echo "Erigon has already terminated" fi # Check test runner script exit status @@ -67,6 +69,7 @@ jobs: fi - name: Delete Erigon Testbed Data Directory + if: always() run: | rm -rf $ERIGON_TESTBED_DATA_DIR @@ -75,13 +78,13 @@ jobs: python3 $ERIGON_QA_PATH/test_system/db-producer/resume_production.py || true - name: Save test results - if: always() + if: steps.test_step.outputs.test_executed == 'true' env: TEST_RESULT: ${{ steps.test_step.outputs.TEST_RESULT }} run: python3 $ERIGON_QA_PATH/test_system/qa-tests/uploads/upload_test_results.py --repo erigon --commit $(git rev-parse HEAD) --test_name tip-tracking --outcome $TEST_RESULT --result_file ${{ github.workspace }}/result.json - name: Upload test results - if: always() + if: steps.test_step.outputs.test_executed == 'true' uses: actions/upload-artifact@v4 with: name: test-results