From 34a3ba8c69417bbab020e404cb314b362f19235f Mon Sep 17 00:00:00 2001 From: Marek Date: Wed, 24 Jan 2024 00:07:53 +0100 Subject: [PATCH] add(scan): Add the `scan_start_where_left` test to CI (#8172) * Add the `scan_start_where_left` test to CI * Fix passing of features Co-authored-by: Arya --------- Co-authored-by: Arya --- ...i-integration-tests-gcp.patch-external.yml | 7 +++ .../workflows/ci-integration-tests-gcp.yml | 51 +++++++++++++++++-- docker/entrypoint.sh | 6 +++ 3 files changed, 59 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci-integration-tests-gcp.patch-external.yml b/.github/workflows/ci-integration-tests-gcp.patch-external.yml index 8d9d68ed5..7590b3b42 100644 --- a/.github/workflows/ci-integration-tests-gcp.patch-external.yml +++ b/.github/workflows/ci-integration-tests-gcp.patch-external.yml @@ -79,6 +79,13 @@ jobs: steps: - run: 'echo "Skipping job on fork"' + scan-start-where-left-test: + name: Scan starts where left / Run scan-start-where-left test + needs: get-available-disks + runs-on: ubuntu-latest + steps: + - run: 'echo "No build required"' + lightwalletd-full-sync: name: lightwalletd tip / Run lwd-full-sync test needs: get-available-disks diff --git a/.github/workflows/ci-integration-tests-gcp.yml b/.github/workflows/ci-integration-tests-gcp.yml index e0d2e07e6..b411d0c75 100644 --- a/.github/workflows/ci-integration-tests-gcp.yml +++ b/.github/workflows/ci-integration-tests-gcp.yml @@ -589,20 +589,46 @@ jobs: # Otherwise, if the state rebuild was skipped, runs immediately after the build job. submit-block-test: name: submit block - needs: [ test-full-sync, get-available-disks ] + needs: [test-full-sync, get-available-disks] uses: ./.github/workflows/sub-deploy-integration-tests-gcp.yml if: ${{ !cancelled() && !failure() && (fromJSON(needs.get-available-disks.outputs.zebra_tip_disk) || needs.test-full-sync.result == 'success') && github.event.inputs.regenerate-disks != 'true' && github.event.inputs.run-full-sync != 'true' && github.event.inputs.run-lwd-sync != 'true' }} with: app_name: zebrad test_id: submit-block test_description: Test submitting blocks via Zebra's rpc server - test_variables: '-e NETWORK=${{ inputs.network || vars.ZCASH_NETWORK }} -e TEST_SUBMIT_BLOCK=1 -e ZEBRA_FORCE_USE_COLOR=1 -e ZEBRA_CACHED_STATE_DIR=/var/cache/zebrad-cache' + test_variables: "-e NETWORK=${{ inputs.network || vars.ZCASH_NETWORK }} -e TEST_SUBMIT_BLOCK=1 -e ZEBRA_FORCE_USE_COLOR=1 -e ZEBRA_CACHED_STATE_DIR=/var/cache/zebrad-cache" needs_zebra_state: true needs_lwd_state: false saves_to_disk: false disk_suffix: tip - root_state_path: '/var/cache' - zebra_state_dir: 'zebrad-cache' + root_state_path: "/var/cache" + zebra_state_dir: "zebrad-cache" + secrets: inherit + + # Test that the scanner can continue scanning where it was left when zebrad restarts. + # + # Runs: + # - after every PR is merged to `main` + # - on every PR update + # + # If the state version has changed, waits for the new cached states to be created. + # Otherwise, if the state rebuild was skipped, runs immediately after the build job. + scan-start-where-left-test: + name: Scan starts where left + needs: [test-full-sync, get-available-disks] + uses: ./.github/workflows/sub-deploy-integration-tests-gcp.yml + if: ${{ !cancelled() && !failure() && (fromJSON(needs.get-available-disks.outputs.zebra_tip_disk) || needs.test-full-sync.result == 'success') && github.event.inputs.regenerate-disks != 'true' && github.event.inputs.run-full-sync != 'true' && github.event.inputs.run-lwd-sync != 'true' }} + with: + app_name: zebrad + test_id: scan-start-where-left + test_description: Test that the scanner can continue scanning where it was left when zebrad restarts. + test_variables: "-e NETWORK=${{ inputs.network || vars.ZCASH_NETWORK }} -e TEST_SCAN_START_WHERE_LEFT=1 -e ZEBRA_FORCE_USE_COLOR=1 -e ZEBRA_CACHED_STATE_DIR=/var/cache/zebrad-cache" + needs_zebra_state: true + needs_lwd_state: false + saves_to_disk: true + disk_suffix: tip + root_state_path: "/var/cache" + zebra_state_dir: "zebrad-cache" secrets: inherit failure-issue: @@ -611,7 +637,22 @@ jobs: # # This list is for reliable tests that are run on the `main` branch. # Testnet jobs are not in this list, because we expect testnet to fail occasionally. - needs: [ regenerate-stateful-disks, test-full-sync, lightwalletd-full-sync, test-stateful-sync, test-update-sync, checkpoints-mainnet, lightwalletd-update-sync, lightwalletd-rpc-test, lightwalletd-transactions-test, lightwalletd-grpc-test, get-block-template-test, submit-block-test ] + needs: + [ + regenerate-stateful-disks, + test-full-sync, + lightwalletd-full-sync, + test-stateful-sync, + test-update-sync, + checkpoints-mainnet, + lightwalletd-update-sync, + lightwalletd-rpc-test, + lightwalletd-transactions-test, + lightwalletd-grpc-test, + get-block-template-test, + submit-block-test, + scan-start-where-left-test, + ] # Only open tickets for failed scheduled jobs, manual workflow runs, or `main` branch merges. # (PR statuses are already reported in the PR jobs list, and checked by Mergify.) if: (failure() && github.event.pull_request == null) || (cancelled() && github.event.pull_request == null) diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 1ffc0c0ba..8db5acaab 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -73,6 +73,7 @@ fi : "${TEST_LWD_TRANSACTIONS:=}" : "${TEST_GET_BLOCK_TEMPLATE:=}" : "${TEST_SUBMIT_BLOCK:=}" +: "${TEST_SCAN_START_WHERE_LEFT:=}" : "${ENTRYPOINT_FEATURES:=}" # Configuration file path @@ -326,6 +327,11 @@ case "$1" in check_directory_files "${ZEBRA_CACHED_STATE_DIR}" run_cargo_test "${ENTRYPOINT_FEATURES}" "submit_block" + elif [[ "${TEST_SCAN_START_WHERE_LEFT}" -eq "1" ]]; then + # Test that the scanner can continue scanning where it was left when zebrad restarts. + check_directory_files "${ZEBRA_CACHED_STATE_DIR}" + run_cargo_test "shielded-scan" "scan_start_where_left" + else exec "$@" fi