wallet-sanity.sh 922 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/usr/bin/env bash
  2. #
  3. # solana-cli integration sanity test
  4. #
  5. set -e
  6. cd "$(dirname "$0")"/..
  7. # shellcheck source=multinode-demo/common.sh
  8. source multinode-demo/common.sh
  9. if [[ -z $1 ]]; then # no network argument, use localhost by default
  10. args=(--url http://127.0.0.1:8899)
  11. else
  12. args=("$@")
  13. fi
  14. args+=(--keypair "$SOLANA_CONFIG_DIR"/faucet.json)
  15. node_readiness=false
  16. timeout=60
  17. while [[ $timeout -gt 0 ]]; do
  18. set +e
  19. output=$($solana_cli "${args[@]}" transaction-count --commitment finalized)
  20. rc=$?
  21. set -e
  22. if [[ $rc -eq 0 && -n $output ]]; then
  23. node_readiness=true
  24. break
  25. fi
  26. sleep 2
  27. (( timeout=timeout-2 ))
  28. done
  29. if ! "$node_readiness"; then
  30. echo "Timed out waiting for cluster to start"
  31. exit 1
  32. fi
  33. (
  34. set -x
  35. $solana_cli "${args[@]}" address
  36. $solana_cli "${args[@]}" balance
  37. $solana_cli "${args[@]}" ping --count 5 --interval 0
  38. $solana_cli "${args[@]}" balance
  39. )
  40. echo PASS
  41. exit 0