From 45b2e45fd8e602cee5947e58723f4ddf26d0baba Mon Sep 17 00:00:00 2001 From: maciejnems Date: Wed, 8 Feb 2023 18:34:17 +0100 Subject: [PATCH] wip4 --- .github/workflows/e2e-tests-main-devnet.yml | 30 +++------------------ local-tests/test_catch_up.py | 12 ++++----- local-tests/test_multiple_restarts.py | 11 +++++--- 3 files changed, 17 insertions(+), 36 deletions(-) diff --git a/.github/workflows/e2e-tests-main-devnet.yml b/.github/workflows/e2e-tests-main-devnet.yml index c49cf49c8c..2e5cf67377 100644 --- a/.github/workflows/e2e-tests-main-devnet.yml +++ b/.github/workflows/e2e-tests-main-devnet.yml @@ -824,6 +824,9 @@ jobs: name: Test multiple restarts runs-on: ubuntu-20.04 needs: build-new-node + strategy: + matrix: + pruning: ['', '--state-pruning 2048'] steps: - name: Checkout source code uses: actions/checkout@v2 @@ -843,32 +846,7 @@ jobs: env: # Relative to local-tests/ directory ALEPH_NODE_BINARY: aleph-release-node/aleph-node - run: ./.github/scripts/test_multiple_restarts.sh - - test-multiple-restarts-pruning: - name: Test multiple restarts - runs-on: ubuntu-20.04 - needs: build-new-node - steps: - - name: Checkout source code - uses: actions/checkout@v2 - - - name: Download all artifacts - uses: actions/download-artifact@v2 - with: - path: local-tests/ - - - name: Setup Python - uses: actions/setup-python@v2 - with: - python-version: '3.8' - - - name: Test multiple restarts - timeout-minutes: 10 - env: - # Relative to local-tests/ directory - ALEPH_NODE_BINARY: aleph-release-node/aleph-node - run: ./.github/scripts/test_multiple_restarts.sh --state-pruning 2048 + run: ./.github/scripts/test_multiple_restarts.sh ${{ matrix.pruning }} check-runtime-change: name: Inspect whether runtime version has been changed (compared with main) diff --git a/local-tests/test_catch_up.py b/local-tests/test_catch_up.py index c84f309aa1..3b44ca7950 100755 --- a/local-tests/test_catch_up.py +++ b/local-tests/test_catch_up.py @@ -7,14 +7,14 @@ from chainrunner import Chain, Seq, generate_keys, check_finalized -argParser = argparse.ArgumentParser() -argParser.add_argument("--state-pruning", help="state pruning argument") -state_pruning = argParser.parse_args().state_pruning - def printt(s): print(ctime() + ' | ' + s) +argParser = argparse.ArgumentParser() +argParser.add_argument("--state-pruning", help="state pruning argument") +state_pruning = argParser.parse_args().state_pruning + # Path to working directory, where chainspec, logs and nodes' dbs are written: workdir = abspath(os.getenv('WORKDIR', '/tmp/workdir')) # Path to the aleph-node binary (important use short-session feature): @@ -60,10 +60,10 @@ def printt(s): print(ctime() + ' | ' + s) chain.start('aleph', nodes=[4, 5]) -printt('Waiting for finalization') -chain.wait_for_finalization(0) printt('Waiting for authorities') chain.wait_for_authorities() +printt('Waiting for finalization') +chain.wait_for_finalization(90) printt('Killing one validator and one nonvalidator') chain.stop(nodes=[3, 4]) diff --git a/local-tests/test_multiple_restarts.py b/local-tests/test_multiple_restarts.py index f1d1fac144..0dd14040c2 100755 --- a/local-tests/test_multiple_restarts.py +++ b/local-tests/test_multiple_restarts.py @@ -29,6 +29,9 @@ def printt(s): print(ctime() + ' | ' + s) sudo_account_id=keys[phrases[0]], chain_type='local') +printt('Purging previous chain') +chain.purge() + chain.set_flags('no-mdns', port=Seq(30334), validator_port=Seq(30343), @@ -51,10 +54,10 @@ def printt(s): print(ctime() + ' | ' + s) printt('Starting the chain') chain.start('aleph') -printt('Waiting for finalization') -chain.wait_for_finalization(0) printt('Waiting for authorities') chain.wait_for_authorities() +printt('Waiting for finalization') +chain.wait_for_finalization(256) delta = 5 @@ -74,7 +77,7 @@ def printt(s): print(ctime() + ' | ' + s) sys.exit(1) printt('Restarting nodes') - chain[3].start('aleph') + chain.start('aleph', nodes=[3]) printt('Waiting for finalization') chain.wait_for_finalization(finalized_before_start[3], nodes=[3]) @@ -84,5 +87,5 @@ def printt(s): print(ctime() + ' | ' + s) # Check if the murdered node started catching up with reasonable nr of blocks. if diff <= delta: - printt(f'Too small catch up for validators: {validator_diff}') + printt(f'Too small catch up for validators: {diff}') sys.exit(1)