From 72138ae8371797c56006fd7ca2894deb98bce5bc Mon Sep 17 00:00:00 2001 From: Michelangelo Riccobene Date: Tue, 6 Feb 2024 12:57:01 +0100 Subject: [PATCH] fix rpc-test dir; refactor rpcdaemon killing code into a task --- .github/workflows/rpc-integration-tests.yml | 34 +++++++++++---------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/.github/workflows/rpc-integration-tests.yml b/.github/workflows/rpc-integration-tests.yml index 4c7f65681c..ef3e303dc4 100644 --- a/.github/workflows/rpc-integration-tests.yml +++ b/.github/workflows/rpc-integration-tests.yml @@ -14,7 +14,6 @@ jobs: runs-on: self-hosted env: ERIGON_DATA_DIR: /opt/erigon/datadir - RPC_TEST_DIR: $GITHUB_WORKSPACE/rpc-tests RPC_PAST_TEST_DIR: /opt/rpc-past-tests steps: @@ -26,8 +25,8 @@ jobs: - name: Checkout rpc-tests repository & install requirements run: | - git clone https://github.com/erigontech/rpc-tests $RPC_TEST_DIR - cd $RPC_TEST_DIR + git clone https://github.com/erigontech/rpc-tests ${{runner.workspace}}/rpc-tests + cd ${{runner.workspace}}/rpc-tests git checkout main pip3 install -r requirements.txt @@ -64,11 +63,12 @@ jobs: run: | ./rpcdaemon --datadir $ERIGON_DATA_DIR --api admin,debug,eth,parity,erigon,trace,web3,txpool,ots,net --log.verbosity 1 --erigon_compatibility --jwt ./jwt.hex --skip_protocol_check & RPC_DAEMON_PID=$! + echo "RPC_DAEMON_PID=$RPC_DAEMON_PID" >> $GITHUB_ENV - name: Run integration tests id: test_step run: | - cd $RPC_TEST_DIR/integration + cd ${{runner.workspace}}/rpc-tests/integration # Run Erigon, send ctrl-c and check logs python3 ./run_tests.py --continue --blockchain mainnet --jwt ${{runner.workspace}}/silkworm/build/cmd/jwt.hex --display-only-fail --port 8545 -x admin_,eth_mining,eth_getWork,eth_coinbase,eth_createAccessList/test_16.json @@ -77,28 +77,30 @@ jobs: monitoring_exit_status=$? # Save test result to a directory with timestamp and commit hash - mv $RPC_TEST_DIR/integration/mainnet/results $RPC_PAST_TEST_DIR/mainnet_$(date +%Y%m%d_%H%M%S)_integration_$(git rev-parse --short HEAD) - - # Clean up Erigon process if it's still running - if kill -0 $RPC_DAEMON_PID 2> /dev/null; then - echo "Terminating rpc-daemon" - kill $RPC_DAEMON_PID - wait $RPC_DAEMON_PID - else - echo "rpc-daemon has already terminated" - fi + mv ${{runner.workspace}}/rpc-tests/integration/mainnet/results $RPC_PAST_TEST_DIR/mainnet_$(date +%Y%m%d_%H%M%S)_integration_$(git rev-parse --short HEAD) # Check monitoring script exit status if [ $monitoring_exit_status -eq 0 ]; then echo "Tests completed successfully" - echo "::notice::Tests completed successfully" echo "TEST_RESULT=success" >> "$GITHUB_OUTPUT" else echo "Error detected during tests" - echo "::error::Error detected during tests" echo "TEST_RESULT=failure" >> "$GITHUB_OUTPUT" fi + - name: Stop SilkRpc + working-directory: ${{runner.workspace}}/silkworm/build/cmd + run: | + # Clean up rpcdaemon process if it's still running + echo "RPC_DAEMON_PID=$RPC_DAEMON_PID" + if kill -0 $RPC_DAEMON_PID 2> /dev/null; then + echo "Terminating rpc-daemon" + kill $RPC_DAEMON_PID + wait $RPC_DAEMON_PID + else + echo "rpc-daemon has already terminated" + fi + #- name: Resume Erigon ("db-producer") # if: always() # run: |