Skip to content

Commit

Permalink
fix rpc-test dir; refactor rpcdaemon killing code into a task
Browse files Browse the repository at this point in the history
  • Loading branch information
mriccobene committed Feb 6, 2024
1 parent 54dba9d commit 72138ae
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions .github/workflows/rpc-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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: |
Expand Down

0 comments on commit 72138ae

Please sign in to comment.