mirror of
https://github.com/romanz/electrs.git
synced 2026-08-13 12:32:52 +02:00
Retry Electrum commands in integration tests
This commit is contained in:
parent
17863fdaaa
commit
65d604606b
1 changed files with 11 additions and 2 deletions
13
tests/run.sh
13
tests/run.sh
|
|
@ -16,6 +16,15 @@ cleanup() {
|
|||
}
|
||||
trap cleanup SIGINT SIGTERM EXIT
|
||||
|
||||
wait_for() {
|
||||
CMD=$1
|
||||
shift
|
||||
TEST_ARGS=$*
|
||||
for _ in `seq 0 9`; do
|
||||
test "$($CMD | jq -c .)" $TEST_ARGS && break || sleep 2
|
||||
done
|
||||
}
|
||||
|
||||
BTC="bitcoin-cli -regtest -datadir=data/bitcoin"
|
||||
ELECTRUM="electrum --regtest"
|
||||
EL="$ELECTRUM --wallet=data/electrum/wallet"
|
||||
|
|
@ -60,7 +69,7 @@ $EL load_wallet
|
|||
echo "Running integration tests:"
|
||||
|
||||
echo " * getbalance"
|
||||
test "`$EL getbalance | jq -c .`" == '{"confirmed":"550","unmatured":"4950"}'
|
||||
wait_for "$EL getbalance" == '{"confirmed":"550","unmatured":"4950"}'
|
||||
|
||||
echo " * getunusedaddress"
|
||||
NEW_ADDR=`$EL getunusedaddress`
|
||||
|
|
@ -69,7 +78,7 @@ echo " * payto & broadcast"
|
|||
TXID=$($EL broadcast $($EL payto $NEW_ADDR 123 --fee 0.001 --password=''))
|
||||
|
||||
echo " * get_tx_status"
|
||||
test "`$EL get_tx_status $TXID | jq -c .`" == '{"confirmations":0}'
|
||||
wait_for "$EL get_tx_status $TXID" == '{"confirmations":0}'
|
||||
|
||||
echo " * getaddresshistory"
|
||||
test "`$EL getaddresshistory $NEW_ADDR | jq -c .`" == "[{\"fee\":100000,\"height\":0,\"tx_hash\":\"$TXID\"}]"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue