Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: pause/resume Erigon, save test results #1921

Merged
merged 12 commits into from
Mar 20, 2024
26 changes: 25 additions & 1 deletion .github/workflows/rpc-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
env:
ERIGON_DATA_DIR: /opt/erigon/datadir
RPC_PAST_TEST_DIR: /opt/rpc-past-tests
ERIGON_QA_PATH: /opt/erigon-qa

steps:
- name: Checkout Silkworm Repository
Expand Down Expand Up @@ -45,6 +46,10 @@ jobs:
working-directory: ${{runner.workspace}}/silkworm/build
run: cmake --build . --config Release --target rpcdaemon -j 8

- name: Pause the Erigon instance dedicated to db maintenance
run: |
python3 $ERIGON_QA_PATH/test_system/db-producer/pause_production.py || true

- name: Start Silkworm RpcDaemon
working-directory: ${{runner.workspace}}/silkworm/build/cmd
run: |
Expand All @@ -60,6 +65,7 @@ jobs:
set +e # Disable exit on error

cd ${{runner.workspace}}/rpc-tests/integration
rm -rf ./mainnet/results/

# Run RPC integration test runner via http
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,engine_ --transport_type http,websocket
Expand All @@ -77,7 +83,7 @@ jobs:
echo "TEST_RESULT=failure" >> "$GITHUB_OUTPUT"

# Save failed results to a directory with timestamp and commit hash
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)_http
cp -r ${{runner.workspace}}/rpc-tests/integration/mainnet/results/ $RPC_PAST_TEST_DIR/mainnet_$(date +%Y%m%d_%H%M%S)_integration_$(git -C ${{runner.workspace}}/silkworm rev-parse --short HEAD)_http/
fi

- name: Stop Silkworm RpcDaemon
Expand All @@ -92,6 +98,24 @@ jobs:
echo "Silkworm RpcDaemon has already terminated"
fi

- name: Resume the Erigon instance dedicated to db maintenance
run: |
python3 $ERIGON_QA_PATH/test_system/db-producer/resume_production.py || true

- name: Upload test results
if: steps.test_step.outputs.TEST_RESULT != 'success'
uses: actions/upload-artifact@v4
with:
name: test-results
path: ${{runner.workspace}}/rpc-tests/integration/mainnet/results/

- name: Save test results
if: steps.test_step.outputs.TEST_RESULT != 'success'
working-directory: ${{runner.workspace}}/silkworm
env:
TEST_RESULT: ${{ steps.test_step.outputs.TEST_RESULT }}
run: python3 $ERIGON_QA_PATH/test_system/qa-tests/uploads/upload_test_results.py --repo silkworm --commit $(git rev-parse HEAD) --test_name rpc-integration-tests --outcome $TEST_RESULT #--result_file ${{runner.workspace}}/rpc-tests/integration/mainnet/result.json

- name: Action for Success
if: steps.test_step.outputs.TEST_RESULT == 'success'
run: echo "::notice::Tests completed successfully"
Expand Down
30 changes: 27 additions & 3 deletions .github/workflows/rpc-performance-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ jobs:
env:
ERIGON_DATA_DIR: /opt/erigon/datadir
RPC_PAST_TEST_DIR: /opt/rpc-past-tests
ERIGON_QA_PATH: /opt/erigon-qa

steps:
- name: Checkout Silkworm repository
Expand Down Expand Up @@ -40,19 +41,24 @@ jobs:
working-directory: ${{runner.workspace}}/silkworm/build
run: cmake --build . --config Release --target rpcdaemon -j 8

- name: Pause the Erigon instance dedicated to db maintenance
run: |
python3 $ERIGON_QA_PATH/test_system/db-producer/pause_production.py || true

- name: Run Silkworm RpcDaemon
working-directory: ${{runner.workspace}}/silkworm/build/cmd
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

canepat marked this conversation as resolved.
Show resolved Hide resolved
- name: Run RPC Performances Tests
- name: Run RPC Performance Tests
id: test_step
run: |
set +e # Disable exit on error

cd ${{runner.workspace}}/rpc-tests/perf
rm -rf ./reports/mainnet

# Launch the RPC performance test runner
python3 ./run_perf_tests.py -b mainnet -y eth_call -p pattern/mainnet/stress_test_eth_call_001_14M.tar -t 1:1,100:30,1000:20,10000:20,20000:20 -r 20 -s ${{runner.workspace}}/silkworm -g $ERIGON_DATA_DIR -m 2 -u
Expand All @@ -66,8 +72,8 @@ jobs:
# Capture test runner script exit status
perf_exit_status=$?

# Save test results to a directory with timestamp and commit hash
mv ${{runner.workspace}}/rpc-tests/perf/reports/mainnet $RPC_PAST_TEST_DIR/mainnet_$(date +%Y%m%d_%H%M%S)_perf_$(git rev-parse --short HEAD)
# Save test results to a directory with timestamp and commit hash
cp -r ${{runner.workspace}}/rpc-tests/perf/reports/mainnet $RPC_PAST_TEST_DIR/mainnet_$(date +%Y%m%d_%H%M%S)_perf_$(git -C ${{runner.workspace}}/silkworm rev-parse --short HEAD)

# Check test runner script exit status
if [ $perf_exit_status -eq 0 ]; then
Expand All @@ -89,6 +95,24 @@ jobs:
echo "rpc-daemon has already terminated"
fi

- name: Resume the Erigon instance dedicated to db maintenance
run: |
python3 $ERIGON_QA_PATH/test_system/db-producer/resume_production.py || true

- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results
path: ${{runner.workspace}}/rpc-tests/perf/reports/mainnet

- name: Save test results
if: always()
working-directory: ${{runner.workspace}}/silkworm
env:
TEST_RESULT: ${{ steps.test_step.outputs.TEST_RESULT }}
run: python3 $ERIGON_QA_PATH/test_system/qa-tests/uploads/upload_test_results.py --repo silkworm --commit $(git rev-parse HEAD) --test_name rpc-performance-tests --outcome $TEST_RESULT #--result_file ${{runner.workspace}}/rpc-tests/perf/reports/mainnet/result.json

- name: Action for Success
if: steps.test_step.outputs.TEST_RESULT == 'success'
run: echo "::notice::Tests completed successfully"
Expand Down
Loading