github.com/MetalBlockchain/metalgo@v1.11.9/scripts/tests.e2e.sh (about) 1 #!/usr/bin/env bash 2 3 set -euo pipefail 4 5 # e.g., 6 # ./scripts/tests.e2e.sh 7 # ./scripts/tests.e2e.sh --ginkgo.label-filter=x # All arguments are supplied to ginkgo 8 # E2E_SERIAL=1 ./scripts/tests.e2e.sh # Run tests serially 9 # METALGO_PATH=./build/metalgo ./scripts/tests.e2e.sh # Customization of avalanchego path 10 if ! [[ "$0" =~ scripts/tests.e2e.sh ]]; then 11 echo "must be run from repository root" 12 exit 255 13 fi 14 15 ################################# 16 # Sourcing constants.sh ensures that the necessary CGO flags are set to 17 # build the portable version of BLST. Without this, ginkgo may fail to 18 # build the test binary if run on a host (e.g. github worker) that lacks 19 # the instructions to build non-portable BLST. 20 source ./scripts/constants.sh 21 22 ################################# 23 echo "building e2e.test" 24 # to install the ginkgo binary (required for test build and run) 25 go install -v github.com/onsi/ginkgo/v2/ginkgo@v2.13.1 26 ACK_GINKGO_RC=true ginkgo build ./tests/e2e 27 ./tests/e2e/e2e.test --help 28 29 # Enable subnet testing by building xsvm 30 ./scripts/build_xsvm.sh 31 echo "" 32 33 # Ensure an absolute path to avoid dependency on the working directory 34 # of script execution. 35 METALGO_PATH="$(realpath "${METALGO_PATH:-./build/metalgo}")" 36 E2E_ARGS="--metalgo-path=${METALGO_PATH}" 37 38 ################################# 39 # Determine ginkgo args 40 GINKGO_ARGS="" 41 if [[ -n "${E2E_SERIAL:-}" ]]; then 42 # Specs will be executed serially. This supports running e2e tests in CI 43 # where parallel execution of tests that start new nodes beyond the 44 # initial set of validators could overload the free tier CI workers. 45 # Forcing serial execution in this test script instead of marking 46 # resource-hungry tests as serial supports executing the test suite faster 47 # on powerful development workstations. 48 echo "tests will be executed serially to minimize resource requirements" 49 else 50 # Enable parallel execution of specs defined in the test binary by 51 # default. This requires invoking the binary via the ginkgo cli 52 # since the test binary isn't capable of executing specs in 53 # parallel. 54 echo "tests will be executed in parallel" 55 GINKGO_ARGS="-p" 56 fi 57 58 ################################# 59 # - Execute in random order to identify unwanted dependency 60 ginkgo ${GINKGO_ARGS} -v --randomize-all ./tests/e2e/e2e.test -- "${E2E_ARGS[@]}" "${@}"