forked from ava-labs/avalanchego
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtests.e2e.sh
executable file
·67 lines (58 loc) · 1.86 KB
/
tests.e2e.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env bash
set -e
set -o nounset
set -o pipefail
# e.g.,
# ./scripts/build.sh
# ./scripts/tests.e2e.sh ./build/avalanchego
if ! [[ "$0" =~ scripts/tests.e2e.sh ]]; then
echo "must be run from repository root"
exit 255
fi
AVALANCHEGO_PATH="${1-}"
if [[ -z "${AVALANCHEGO_PATH}" ]]; then
echo "Missing AVALANCHEGO_PATH argument!"
echo "Usage: ${0} [AVALANCHEGO_PATH]" >>/dev/stderr
exit 255
fi
#################################
echo "installing avalanche-network-runner"
ANR_WORKDIR="/tmp"
./scripts/install_anr.sh
# Sourcing constants.sh ensures that the necessary CGO flags are set to
# build the portable version of BLST. Without this, ginkgo may fail to
# build the test binary if run on a host (e.g. github worker) that lacks
# the instructions to build non-portable BLST.
source ./scripts/constants.sh
#################################
echo "building e2e.test"
# to install the ginkgo binary (required for test build and run)
go install -v github.com/onsi/ginkgo/v2/[email protected]
ACK_GINKGO_RC=true ginkgo build ./tests/e2e
./tests/e2e/e2e.test --help
#################################
# run "avalanche-network-runner" server
echo "launch avalanche-network-runner in the background"
$ANR_WORKDIR/avalanche-network-runner \
server \
--log-level debug \
--port=":12342" \
--disable-grpc-gateway &
PID=${!}
#################################
echo "running e2e tests against the local cluster with ${AVALANCHEGO_PATH}"
./tests/e2e/e2e.test \
--ginkgo.v \
--log-level debug \
--network-runner-grpc-endpoint="0.0.0.0:12342" \
--network-runner-avalanchego-path=${AVALANCHEGO_PATH} \
--network-runner-avalanchego-log-level="WARN" \
--test-keys-file=tests/test.insecure.secp256k1.keys &&
EXIT_CODE=$? || EXIT_CODE=$?
kill ${PID}
if [[ ${EXIT_CODE} -gt 0 ]]; then
echo "FAILURE with exit code ${EXIT_CODE}"
exit ${EXIT_CODE}
else
echo "ALL SUCCESS!"
fi