solana/ci/testnet-sanity.sh

79 lines
1.6 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
set -e
2018-07-16 12:05:48 -07:00
cd "$(dirname "$0")/.."
2018-12-22 12:34:30 -08:00
source ci/upload-ci-artifact.sh
2018-07-16 12:05:48 -07:00
usage() {
exitcode=0
if [[ -n "$1" ]]; then
exitcode=1
echo "Error: $*"
2018-08-17 20:41:30 -07:00
fi
cat <<EOF
usage: $0 [name] [cloud] [zone1] ... [zoneN]
2018-07-20 08:50:08 -07:00
Sanity check a testnet
2018-07-16 12:05:48 -07:00
name - name of the network
cloud - cloud provider to use (gce, ec2)
zone1 .. zoneN - cloud provider zones to check
Note: the SOLANA_METRICS_CONFIG environment variable is used to configure
metrics
EOF
exit $exitcode
}
2018-08-13 12:13:00 -07:00
netName=$1
2018-11-06 19:23:20 -08:00
cloudProvider=$2
[[ -n $netName ]] || usage ""
2018-11-06 19:23:20 -08:00
[[ -n $cloudProvider ]] || usage "Cloud provider not specified"
shift 2
maybePublicNetwork=
if [[ $1 = -P ]]; then
maybePublicNetwork=-P
shift
fi
[[ -n $1 ]] || usage "zone1 not specified"
shutdown() {
exitcode=$?
set +e
2018-12-23 09:11:15 -08:00
if [[ -d net/log ]]; then
mv net/log net/log-sanity
for logfile in net/log-sanity/*; do
if [[ -f $logfile ]]; then
upload-ci-artifact "$logfile"
tail "$logfile"
fi
done
fi
exit $exitcode
}
2018-12-23 09:11:15 -08:00
rm -rf net/{log,-sanity}
rm -f net/config/config
trap shutdown EXIT INT
set -x
for zone in "$@"; do
echo "--- $cloudProvider config [$zone]"
2020-01-20 18:19:15 -08:00
timeout 5m net/"$cloudProvider".sh config $maybePublicNetwork -n 1 -p "$netName" -z "$zone"
net/init-metrics.sh -e
echo "+++ $cloudProvider.sh info"
net/"$cloudProvider".sh info
echo "--- net.sh sanity [$cloudProvider:$zone]"
ok=true
2019-04-17 18:09:40 -07:00
timeout 5m net/net.sh sanity \
${REJECT_EXTRA_NODES:+-o rejectExtraNodes} \
${NO_INSTALL_CHECK:+-o noInstallCheck} \
2019-04-17 18:09:40 -07:00
$zone || ok=false
2018-08-09 18:35:43 -07:00
2019-09-20 14:47:00 -07:00
if ! $ok; then
net/net.sh logs
fi
$ok
done