2022-05-11 16:41:33 -07:00
|
|
|
#!/usr/bin/env bash
|
2022-03-02 06:15:24 -08:00
|
|
|
|
2022-05-11 16:41:33 -07:00
|
|
|
# show the commands we are executing
|
2022-03-02 06:15:24 -08:00
|
|
|
set -x
|
2022-05-11 16:41:33 -07:00
|
|
|
# exit if a command fails
|
|
|
|
set -e
|
|
|
|
# exit if any command in a pipeline fails
|
|
|
|
set -o pipefail
|
2022-03-02 06:15:24 -08:00
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
-- | cargo)
|
2022-05-11 07:06:58 -07:00
|
|
|
# For these tests, we activate the gRPC feature to avoid recompiling `zebrad`,
|
|
|
|
# but we might not actually run any gRPC tests.
|
2022-03-05 09:32:46 -08:00
|
|
|
if [[ "$RUN_ALL_TESTS" -eq "1" ]]; then
|
2022-05-11 07:06:58 -07:00
|
|
|
# Run all the available tests for the current environment.
|
|
|
|
# If the lightwalletd environmental variables are set, we will also run those tests.
|
2022-05-11 16:41:33 -07:00
|
|
|
exec cargo test --locked --release --features lightwalletd-grpc-tests --workspace -- --nocapture --include-ignored
|
2022-05-11 07:06:58 -07:00
|
|
|
|
|
|
|
# For these tests, we activate the gRPC feature to avoid recompiling `zebrad`,
|
|
|
|
# but we don't actually run any gRPC tests.
|
2022-03-05 09:32:46 -08:00
|
|
|
elif [[ "$TEST_FULL_SYNC" -eq "1" ]]; then
|
2022-05-11 07:06:58 -07:00
|
|
|
# Run a Zebra full sync test.
|
2022-05-11 16:41:33 -07:00
|
|
|
exec cargo test --locked --release --features lightwalletd-grpc-tests --package zebrad --test acceptance -- --nocapture --include-ignored full_sync_mainnet
|
2022-05-04 15:55:02 -07:00
|
|
|
elif [[ "$TEST_DISK_REBUILD" -eq "1" ]]; then
|
2022-05-11 07:06:58 -07:00
|
|
|
# Run a Zebra sync up to the mandatory checkpoint.
|
2022-05-11 16:41:33 -07:00
|
|
|
#
|
|
|
|
# TODO: use environmental variables instead of Rust features (part of #2995)
|
|
|
|
exec cargo test --locked --release --features "test_sync_to_mandatory_checkpoint_${NETWORK,,},lightwalletd-grpc-tests" --package zebrad --test acceptance -- --nocapture --include-ignored "sync_to_mandatory_checkpoint_${NETWORK,,}"
|
2022-05-04 15:55:02 -07:00
|
|
|
elif [[ "$TEST_CHECKPOINT_SYNC" -eq "1" ]]; then
|
2022-05-11 07:06:58 -07:00
|
|
|
# Run a Zebra sync starting at the cached mandatory checkpoint, and syncing past it.
|
2022-05-11 16:41:33 -07:00
|
|
|
#
|
|
|
|
# TODO: use environmental variables instead of Rust features (part of #2995)
|
|
|
|
exec cargo test --locked --release --features "test_sync_past_mandatory_checkpoint_${NETWORK,,},lightwalletd-grpc-tests" --package zebrad --test acceptance -- --nocapture --include-ignored "sync_past_mandatory_checkpoint_${NETWORK,,}"
|
2022-05-05 02:27:07 -07:00
|
|
|
elif [[ "$TEST_LWD_RPC_CALL" -eq "1" ]]; then
|
2022-05-11 07:06:58 -07:00
|
|
|
# Starting at a cached tip, test a JSON-RPC call to Zebra.
|
2022-05-11 16:41:33 -07:00
|
|
|
exec cargo test --locked --release --features lightwalletd-grpc-tests --package zebrad --test acceptance -- --nocapture --include-ignored fully_synced_rpc_test
|
2022-05-11 07:06:58 -07:00
|
|
|
elif [[ "$TEST_LWD_FULL_SYNC" -eq "1" ]]; then
|
|
|
|
# Starting at a cached Zebra tip, run a lightwalletd sync to tip.
|
2022-05-11 16:41:33 -07:00
|
|
|
exec cargo test --locked --release --features lightwalletd-grpc-tests --package zebrad --test acceptance -- --nocapture --include-ignored lightwalletd_full_sync
|
2022-05-13 15:02:05 -07:00
|
|
|
elif [[ "$TEST_LWD_UPDATE_SYNC" -eq "1" ]]; then
|
|
|
|
# Starting with a cached Zebra and lightwalletd tip, run a quick update sync.
|
|
|
|
exec cargo test --locked --release --features lightwalletd-grpc-tests --package zebrad --test acceptance -- --nocapture --include-ignored lightwalletd_update_sync
|
2022-05-11 07:06:58 -07:00
|
|
|
|
|
|
|
# These tests actually use gRPC.
|
2022-05-05 22:30:38 -07:00
|
|
|
elif [[ "$TEST_LWD_TRANSACTIONS" -eq "1" ]]; then
|
2022-05-11 07:06:58 -07:00
|
|
|
# Starting at a cached tip, test a gRPC call to lightwalletd, which calls Zebra.
|
2022-05-11 16:41:33 -07:00
|
|
|
exec cargo test --locked --release --features lightwalletd-grpc-tests --package zebrad --test acceptance -- --nocapture --include-ignored sending_transactions_using_lightwalletd
|
2022-05-11 07:06:58 -07:00
|
|
|
|
|
|
|
# These command-lines are provided by the caller.
|
2022-03-05 09:32:46 -08:00
|
|
|
else
|
|
|
|
exec "$@"
|
2022-03-02 06:15:24 -08:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
zebrad)
|
|
|
|
exec zebrad "$@"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
exec "$@"
|
|
|
|
esac
|
|
|
|
|
2022-05-11 07:06:58 -07:00
|
|
|
exit 1
|