@@ -46,20 +46,19 @@ CLEAR='\033[0m'
4646RED=' \033[0;31m'
4747GREEN=' \033[0;32m'
4848
49- NETWORK=devnet
49+ DEFAULT_NETWORK=devnet
50+ NETWORK=$DEFAULT_NETWORK
5051TIMEOUT=900
5152DB_CONN_STR=" postgres://pguser:pguser@localhost:5432/archive"
5253UPGRADE_SCRIPTS_WORKDIR=" src/app/archive"
5354
5455LOAD_TEST_DURATION=600
5556RUN_LOAD_TEST=false
56- RUN_COMPATIBILITY_TEST=false
57- COMPATIBILITY_BRANCH=" "
5857
5958while [[ " $# " -gt 0 ]]; do case $1 in
6059 -n|--network) NETWORK=" $2 " ; shift ;;
6160 --run-load-test) RUN_LOAD_TEST=true ;;
62- --run-compatibility-test) RUN_COMPATIBILITY_TEST=true ; COMPATIBILITY_BRANCH=" $2 " ; shift ;;
61+ --run-compatibility-test) COMPATIBILITY_BRANCH=" $2 " ; shift ;;
6362 -t|--tag) TAG=" $2 " ; shift ;;
6463 --timeout) TIMEOUT=" $2 " ; shift ;;
6564 --upgrade-scripts-workdir) UPGRADE_SCRIPTS_WORKDIR=" $2 " ; shift ;;
@@ -73,7 +72,7 @@ function usage() {
7372 fi
7473 echo " Usage: $0 [-t docker-tag] [-n network]"
7574 echo " -t, --version The version to be used in the docker image tag"
76- echo " -n, --network The network configuration to use (devnet or mainnet). Default=$NETWORK "
75+ echo " -n, --network The network configuration to use (devnet or mainnet). Default=$DEFAULT_NETWORK "
7776 echo " --timeout The timeout duration in seconds. Default=$TIMEOUT "
7877 echo " --run-compatibility-test Enable compatibility testing with specified branch"
7978 echo " --upgrade-scripts-workdir Working directory for upgrade/downgrade scripts. Default=$UPGRADE_SCRIPTS_WORKDIR "
@@ -88,11 +87,14 @@ function usage() {
8887 echo " "
8988}
9089
90+ if [[ " $NETWORK " != " devnet" && " $NETWORK " != " mainnet" && " $NETWORK " != " berkeley" ]]; then
91+ echo " ❌ Invalid network: $NETWORK "
92+ echo " ❌ Network must be either 'devnet' or 'mainnet' or 'berkeley'"
93+ echo " "
94+ usage; exit 1;
95+ fi
96+
9197if [[ -z " $TAG " ]]; then usage " Docker tag is not set!" ; usage; exit 1; fi ;
92- if [[ " $RUN_COMPATIBILITY_TEST " == true && -z " $COMPATIBILITY_BRANCH " ]]; then
93- usage " Compatibility branch is required when running compatibility test!" ;
94- exit 1;
95- fi ;
9698
9799container_id=$( docker run -v .:/workdir -p 3087:3087 -d --env MINA_NETWORK=$NETWORK gcr.io/o1labs-192920/mina-rosetta:$TAG -$NETWORK )
98100
160162fi
161163
162164# Run compatibility test
163- if [[ " $RUN_COMPATIBILITY_TEST " == true ]]; then
165+ if [[ -n " ${COMPATIBILITY_BRANCH :- } " ]]; then
164166 echo " Running compatibility test with branch: $COMPATIBILITY_BRANCH "
165167
166168 upgrade_script_path=" /etc/mina/archive/upgrade-to-mesa.sql"
0 commit comments