33set -euo pipefail
44
55# e.g.,
6- # ./scripts/build.sh
7- # ./ scripts/tests.upgrade.sh 1.7.16 ./build/ avalanchego
6+ # ./scripts/tests.upgrade.sh 1.7.16
7+ # AVALANCHEGO_PATH=./path/to/avalanchego ./ scripts/tests.upgrade.sh 1.7.16 # Customization of avalanchego path
88if ! [[ " $0 " =~ scripts/tests.upgrade.sh ]]; then
99 echo " must be run from repository root"
1010 exit 255
1313VERSION=" ${1:- } "
1414if [[ -z " ${VERSION} " ]]; then
1515 echo " Missing version argument!"
16- echo " Usage: ${0} [VERSION] [NEW-BINARY] " >> /dev/stderr
16+ echo " Usage: ${0} [VERSION]" >> /dev/stderr
1717 exit 255
1818fi
1919
20- NEW_BINARY=" ${2:- } "
21- if [[ -z " ${NEW_BINARY} " ]]; then
22- echo " Missing new binary path argument!"
23- echo " Usage: ${0} [VERSION] [NEW-BINARY]" >> /dev/stderr
20+ AVALANCHEGO_PATH=" ${AVALANCHEGO_PATH:- ./ build/ avalanchego} "
21+ if [[ -z " ${AVALANCHEGO_PATH} " ]]; then
22+ echo " Empty AVALANCHEGO_PATH env var!"
2423 exit 255
2524fi
25+ AVALANCHEGO_PATH=" $( realpath ${AVALANCHEGO_PATH} ) "
2626
2727# ################################
2828# download avalanchego
@@ -52,11 +52,6 @@ elif [[ ${GOOS} == "darwin" ]]; then
5252fi
5353find /tmp/avalanchego-v${VERSION}
5454
55- # ################################
56- echo " installing avalanche-network-runner"
57- ANR_WORKDIR=" /tmp"
58- ./scripts/install_anr.sh
59-
6055# Sourcing constants.sh ensures that the necessary CGO flags are set to
6156# build the portable version of BLST. Without this, ginkgo may fail to
6257# build the test binary if run on a host (e.g. github worker) that lacks
@@ -70,35 +65,10 @@ go install -v github.com/onsi/ginkgo/v2/
[email protected] 7065ACK_GINKGO_RC=true ginkgo build ./tests/upgrade
7166./tests/upgrade/upgrade.test --help
7267
73- # ################################
74- # run "avalanche-network-runner" server
75- echo " launch avalanche-network-runner in the background"
76- $ANR_WORKDIR /avalanche-network-runner \
77- server \
78- --log-level debug \
79- --port=" :12340" \
80- --disable-grpc-gateway &
81- PID=${! }
82-
8368# ################################
8469# By default, it runs all upgrade test cases!
85- echo " running upgrade tests against the local cluster with ${NEW_BINARY } "
70+ echo " running upgrade tests against the local cluster with ${AVALANCHEGO_PATH } "
8671./tests/upgrade/upgrade.test \
8772 --ginkgo.v \
88- --log-level debug \
89- --network-runner-grpc-endpoint=" 0.0.0.0:12340" \
90- --network-runner-avalanchego-path=/tmp/avalanchego-v${VERSION} /avalanchego \
91- --network-runner-avalanchego-path-to-upgrade=${NEW_BINARY} \
92- --network-runner-avalanchego-log-level=" WARN" || EXIT_CODE=$?
93-
94- # "e2e.test" already terminates the cluster
95- # just in case tests are aborted, manually terminate them again
96- pkill -P ${PID} || true
97- kill -2 ${PID}
98-
99- if [[ " ${EXIT_CODE:- } " -gt 0 ]]; then
100- echo " FAILURE with exit code ${EXIT_CODE} "
101- exit ${EXIT_CODE}
102- else
103- echo " ALL SUCCESS!"
104- fi
73+ --avalanchego-path=/tmp/avalanchego-v${VERSION} /avalanchego \
74+ --avalanchego-path-to-upgrade-to=${AVALANCHEGO_PATH}
0 commit comments