From dce8fa9003bc3e89ecccf09f872096ac7b7842e2 Mon Sep 17 00:00:00 2001 From: Michael Vines Date: Mon, 2 Jul 2018 14:14:34 -0700 Subject: [PATCH] Add manual wallet sanity test --- multinode-demo/test/wallet-sanity.sh | 31 ++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 multinode-demo/test/wallet-sanity.sh diff --git a/multinode-demo/test/wallet-sanity.sh b/multinode-demo/test/wallet-sanity.sh new file mode 100755 index 00000000000000..5a0b06a710b20d --- /dev/null +++ b/multinode-demo/test/wallet-sanity.sh @@ -0,0 +1,31 @@ +#!/bin/bash -e +# +# Wallet sanity test +# + +here=$(dirname "$0") +cd "$here" + +wallet="../wallet.sh $1" + +# Tokens transferred to this address are lost forever... +garbage_address=vS3ngn1TfQmpsW1Z4NkLuqNAQFF3dYQw8UZ6TCx9bmq + +check_balance() { + declare expected_balance="Your balance is: $1" + exec 42>&1 + balance=$($wallet balance | tee >(cat - >&42)) + if [[ ! "$balance" =~ $expected_balance ]]; then + echo "Balance is incorrect. Expected: $expected_balance" + exit 1 + fi +} + +$wallet address +check_balance 0 +$wallet airdrop --tokens 100 +check_balance 100 +$wallet pay --to $garbage_address --tokens 100 +check_balance 0 + +exit 0