solana/scripts/wallet-sanity.sh

49 lines
922 B
Bash
Raw Normal View History

#!/usr/bin/env bash
2018-07-02 14:14:34 -07:00
#
# solana-cli integration sanity test
2018-07-02 14:14:34 -07:00
#
2018-11-11 09:25:59 -08:00
set -e
2018-07-02 14:14:34 -07:00
cd "$(dirname "$0")"/..
2018-07-02 14:14:34 -07:00
# shellcheck source=multinode-demo/common.sh
source multinode-demo/common.sh
if [[ -z $1 ]]; then # no network argument, use localhost by default
args=(--url http://127.0.0.1:8899)
2018-07-13 22:10:39 -07:00
else
args=("$@")
2018-07-13 22:10:39 -07:00
fi
2018-07-02 14:14:34 -07:00
args+=(--keypair "$SOLANA_CONFIG_DIR"/faucet.json)
2018-11-10 17:07:31 -08:00
2019-01-16 16:00:12 -08:00
node_readiness=false
timeout=60
while [[ $timeout -gt 0 ]]; do
set +e
output=$($solana_cli "${args[@]}" transaction-count --commitment finalized)
rc=$?
set -e
if [[ $rc -eq 0 && -n $output ]]; then
2019-01-16 16:00:12 -08:00
node_readiness=true
break
fi
sleep 2
(( timeout=timeout-2 ))
done
2019-01-16 16:00:12 -08:00
if ! "$node_readiness"; then
echo "Timed out waiting for cluster to start"
exit 1
fi
(
set -x
$solana_cli "${args[@]}" address
$solana_cli "${args[@]}" balance
$solana_cli "${args[@]}" ping --count 5 --interval 0
$solana_cli "${args[@]}" balance
)
2018-07-02 14:14:34 -07:00
echo PASS
exit 0