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

qa-tests: add rpc integration tests (release/2.60) #11768

Merged
merged 6 commits into from
Aug 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
323 changes: 323 additions & 0 deletions .github/workflows/qa-rpc-integration-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,323 @@
name: QA - RPC Integration Tests

on:
push:
branches:
- 'release/2.*'
pull_request:
branches:
- 'release/2.*'
types:
- ready_for_review
workflow_dispatch: # Run manually

jobs:
integration-test-suite:
runs-on: [self-hosted, Erigon2]
env:
ERIGON_REFERENCE_DATA_DIR: /opt/erigon-versions/reference-version/datadir
ERIGON_TESTBED_DATA_DIR: /opt/erigon-testbed/datadir
ERIGON_QA_PATH: /home/qarunner/erigon-qa
RPC_PAST_TEST_DIR: /opt/rpc-past-tests
CHAIN: mainnet

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Checkout RPC Tests Repository & Install Requirements
run: |
rm -rf ${{ runner.workspace }}/rpc-tests
git -c advice.detachedHead=false clone --depth 1 --branch v0.42.0 https://github.com/erigontech/rpc-tests ${{runner.workspace}}/rpc-tests
cd ${{ runner.workspace }}/rpc-tests
pip3 install -r requirements.txt

- name: Clean Erigon Build Directory
run: |
make clean

- name: Build Erigon RPCDaemon
run: |
make erigon
working-directory: ${{ github.workspace }}

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

- name: Restore Erigon Testbed Data Directory
run: |
rsync -a --delete $ERIGON_REFERENCE_DATA_DIR/ $ERIGON_TESTBED_DATA_DIR/

- name: Run RpcDaemon
working-directory: ${{ github.workspace }}/build/bin
run: |
echo "Erigon (RpcDaemon) starting..."

./erigon --datadir $ERIGON_TESTBED_DATA_DIR --http.api admin,debug,eth,parity,erigon,trace,web3,txpool,ots,net --ws --verbosity 1 > erigon.log 2>&1 &

RPC_DAEMON_PID=$!
echo "RPC_DAEMON_PID=$RPC_DAEMON_PID" >> $GITHUB_ENV

echo "Erigon (RpcDaemon) started"

- name: Wait for port 8545 to be opened
run: |
for i in {1..30}; do
if nc -z localhost 8545; then
echo "Port 8545 is open"
break
fi
echo "Waiting for port 8545 to open..."
sleep 10
done
if ! nc -z localhost 8545; then
echo "Port 8545 did not open in time"
exit 1
fi

- name: Run RPC Integration Tests
id: test_step
run: |
set +e # Disable exit on error
commit=$(git -C ${{runner.workspace}}/erigon rev-parse --short HEAD)

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

# Run RPC integration test runner via http
python3 ./run_tests.py -p 8545 --continue -f -x debug_accountRange/test_09.tar,\
debug_accountRange/test_12.tar,\
debug_accountRange/test_14.json,\
debug_getModifiedAccountsByHash/test_01.json,\
debug_getModifiedAccountsByHash/test_02.json,\
debug_getModifiedAccountsByHash/test_03.json,\
debug_getModifiedAccountsByHash/test_04.json,\
debug_getModifiedAccountsByHash/test_05.tar,\
debug_getModifiedAccountsByHash/test_06.tar,\
debug_getModifiedAccountsByHash/test_07.tar,\
debug_getModifiedAccountsByHash/test_08.json,\
debug_getModifiedAccountsByHash/test_09.json,\
debug_getModifiedAccountsByHash/test_10.json,\
debug_getModifiedAccountsByHash/test_11.json,\
debug_getModifiedAccountsByHash/test_12.json,\
debug_getModifiedAccountsByHash/test_13.tar,\
debug_getModifiedAccountsByHash/test_14.json,\
debug_getModifiedAccountsByHash/test_15.tar,\
debug_getModifiedAccountsByHash/test_16.tar,\
debug_getModifiedAccountsByHash/test_17.tar,\
debug_getModifiedAccountsByHash/test_18.tar,\
debug_getModifiedAccountsByNumber/test_01.json,\
debug_getModifiedAccountsByNumber/test_02.json,\
debug_getModifiedAccountsByNumber/test_03.json,\
debug_getModifiedAccountsByNumber/test_04.json,\
debug_getModifiedAccountsByNumber/test_05.tar,\
debug_getModifiedAccountsByNumber/test_06.tar,\
debug_getModifiedAccountsByNumber/test_07.tar,\
debug_getModifiedAccountsByNumber/test_08.json,\
debug_getModifiedAccountsByNumber/test_09.json,\
debug_getModifiedAccountsByNumber/test_10.json,\
debug_getModifiedAccountsByNumber/test_11.json,\
debug_getModifiedAccountsByNumber/test_12.json,\
debug_getModifiedAccountsByNumber/test_13.tar,\
debug_getModifiedAccountsByNumber/test_14.json,\
debug_getModifiedAccountsByNumber/test_15.tar,\
debug_getModifiedAccountsByNumber/test_16.tar,\
debug_getModifiedAccountsByNumber/test_17.tar,\
debug_getModifiedAccountsByNumber/test_18.json,\
debug_traceBlockByHash/test_01.tar,\
debug_traceBlockByHash/test_02.tar,\
debug_traceBlockByHash/test_03.tar,\
debug_traceBlockByNumber/test_03.tar,\
debug_traceBlockByNumber/test_05.tar,\
debug_traceBlockByNumber/test_06.tar,\
debug_traceBlockByNumber/test_08.tar,\
debug_traceBlockByNumber/test_09.tar,\
debug_traceBlockByNumber/test_10.tar,\
debug_traceBlockByNumber/test_11.tar,\
debug_traceBlockByNumber/test_12.tar,\
debug_traceCall/test_01.json,\
debug_traceCall/test_02.json,\
debug_traceCall/test_05.tar,\
debug_traceCall/test_06.tar,\
debug_traceCall/test_07.tar,\
debug_traceCall/test_08.tar,\
debug_traceCall/test_09.json,\
debug_traceCall/test_10.tar,\
debug_traceCallMany/test_01.json,\
debug_traceCallMany/test_02.json,\
debug_traceCallMany/test_05.tar,\
debug_traceCallMany/test_06.tar,\
debug_traceCallMany/test_07.tar,\
debug_traceCallMany/test_08.tar,\
debug_traceCallMany/test_09.json,\
debug_traceCallMany/test_10.tar,\
debug_traceTransaction/test_02.tar,\
debug_traceTransaction/test_03.tar,\
debug_traceTransaction/test_05.tar,\
debug_traceTransaction/test_06.tar,\
debug_traceTransaction/test_07.tar,\
debug_traceTransaction/test_10.tar,\
debug_traceTransaction/test_11.tar,\
debug_traceTransaction/test_13.tar,\
debug_traceTransaction/test_16.json,\
debug_traceTransaction/test_17.tar,\
debug_traceTransaction/test_18.tar,\
debug_traceTransaction/test_19.json,\
debug_traceTransaction/test_20.json,\
debug_traceTransaction/test_21.json,\
debug_traceTransaction/test_23.json,\
debug_traceTransaction/test_24.json,\
debug_traceTransaction/test_25.json,\
debug_traceTransaction/test_26.json,\
debug_traceTransaction/test_27.json,\
debug_traceTransaction/test_28.tar,\
engine_exchangeCapabilities/test_1.json,\
engine_exchangeTransitionConfigurationV1/test_01.json,\
engine_getClientVersionV1/test_1.json,\
erigon_getLogsByHash/test_04.json,\
eth_callBundle/test_09.json,\
eth_callBundle/test_12.json,\
eth_createAccessList/test_06.json,\
eth_createAccessList/test_07.json,\
eth_createAccessList/test_15.json,\
eth_createAccessList/test_16.json,\
eth_getBlockTransactionCountByHash/test_02.json,\
eth_getBlockTransactionCountByNumber/test_08.json,\
eth_getUncleCountByBlockHash/test_03.json,\
parity_getBlockReceipts/test_01.json,\
parity_getBlockReceipts/test_02.json,\
parity_getBlockReceipts/test_03.json,\
parity_getBlockReceipts/test_04.json,\
parity_getBlockReceipts/test_05.json,\
parity_getBlockReceipts/test_06.json,\
parity_getBlockReceipts/test_07.json,\
parity_getBlockReceipts/test_08.json,\
parity_getBlockReceipts/test_09.json,\
parity_getBlockReceipts/test_10.json,\
trace_call/test_02.json,\
trace_call/test_04.tar,\
trace_call/test_08.tar,\
trace_call/test_11.tar,\
trace_call/test_13.json,\
trace_call/test_17.tar,\
trace_call/test_19.tar,\
trace_call/test_20.json,\
trace_callMany/test_01.json,\
trace_callMany/test_02.json,\
trace_callMany/test_03.json,\
trace_callMany/test_04.json,\
trace_callMany/test_05.json,\
trace_callMany/test_06.json,\
trace_callMany/test_08.json,\
trace_callMany/test_09.json,\
trace_callMany/test_10.json,\
trace_callMany/test_11.json,\
trace_rawTransaction/test_01.json,\
trace_rawTransaction/test_03.json,\
trace_replayBlockTransactions/test_01.tar,\
trace_replayBlockTransactions/test_02.tar,\
trace_replayBlockTransactions/test_03.tar,\
trace_replayBlockTransactions/test_04.tar,\
trace_replayBlockTransactions/test_05.tar,\
trace_replayBlockTransactions/test_08.tar,\
trace_replayBlockTransactions/test_10.json,\
trace_replayBlockTransactions/test_11.json,\
trace_replayBlockTransactions/test_13.tar,\
trace_replayBlockTransactions/test_14.tar,\
trace_replayBlockTransactions/test_15.tar,\
trace_replayBlockTransactions/test_16.tar,\
trace_replayBlockTransactions/test_17.tar,\
trace_replayBlockTransactions/test_18.tar,\
trace_replayBlockTransactions/test_19.tar,\
trace_replayBlockTransactions/test_20.tar,\
trace_replayBlockTransactions/test_21.tar,\
trace_replayBlockTransactions/test_22.tar,\
trace_replayBlockTransactions/test_23.tar,\
trace_replayBlockTransactions/test_24.tar,\
trace_replayBlockTransactions/test_25.tar,\
trace_replayTransaction/test_02.tar,\
trace_replayTransaction/test_03.tar,\
trace_replayTransaction/test_04.tar,\
trace_replayTransaction/test_05.tar,\
trace_replayTransaction/test_06.tar,\
trace_replayTransaction/test_07.tar,\
trace_replayTransaction/test_10.tar,\
trace_replayTransaction/test_11.tar,\
trace_replayTransaction/test_14.tar,\
trace_replayTransaction/test_16.tar,\
trace_replayTransaction/test_18.tar,\
trace_replayTransaction/test_23.tar,\
trace_replayTransaction/test_24.json,\
trace_replayTransaction/test_29.tar

# Capture test runner script exit status
test_exit_status=$?

# Save the subsection reached status
echo "::set-output name=test_executed::true"

# Check test runner exit status
if [ $test_exit_status -eq 0 ]; then
echo "tests completed successfully"
echo
echo "TEST_RESULT=success" >> "$GITHUB_OUTPUT"
else
echo "error detected during tests"
echo "TEST_RESULT=failure" >> "$GITHUB_OUTPUT"

# Save failed results to a directory with timestamp and commit hash
cp -r ${{ runner.workspace }}/rpc-tests/integration/mainnet/results/ $RPC_PAST_TEST_DIR/mainnet_$(date +%Y%m%d_%H%M%S)_integration_$commit_http/
fi

- name: Stop Erigon RpcDaemon
working-directory: ${{ github.workspace }}/build/bin
run: |
# Clean up rpcdaemon process if it's still running
if kill -0 $RPC_DAEMON_PID 2> /dev/null; then
echo "Erigon RpcDaemon stopping..."
kill $RPC_DAEMON_PID
echo "Erigon RpcDaemon stopped"
else
echo "Erigon RpcDaemon has already terminated"
fi

- name: Delete Erigon Testbed Data Directory
if: always()
run: |
rm -rf $ERIGON_TESTBED_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: Upload test results
if: steps.test_step.outputs.test_executed == 'true'
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_executed == 'true'
working-directory: ${{ github.workspace }}
env:
TEST_RESULT: ${{ steps.test_step.outputs.TEST_RESULT }}
run: |
db_version=$(python3 $ERIGON_QA_PATH/test_system/qa-tests/uploads/prod_info.py $ERIGON_REFERENCE_DATA_DIR/../production.ini production erigon_repo_commit)
if [ -z "$db_version" ]; then
db_version="no-version"
fi

python3 $ERIGON_QA_PATH/test_system/qa-tests/uploads/upload_test_results.py --repo erigon --commit $(git rev-parse HEAD) --branch ${{ github.ref_name }} --test_name rpc-integration-tests --chain $CHAIN --runner ${{ runner.name }} --db_version $db_version --outcome $TEST_RESULT #--result_file ${{ github.workspace }}/result-$CHAIN.json

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

- name: Action for Failure
if: steps.test_step.outputs.TEST_RESULT != 'success'
run: |
echo "::error::Error detected during tests"
exit 1

Loading