Add integration test for withdrawals

This commit is contained in:
Torsten Grote 2020-05-18 13:45:21 -03:00
parent ff50526560
commit a3354306c6
No known key found for this signature in database
GPG Key ID: 3E5F77D92CF891FF
3 changed files with 40 additions and 0 deletions

View File

@ -114,6 +114,9 @@ function wait_for_services() {
OK=1
break
done
if [ 1 != $OK ]; then
exit_skip "Failed to launch bank"
fi
# Wait for all other services to be available
for _ in $(seq 1 50); do
echo -n "."
@ -170,6 +173,10 @@ function assert_greater_than() {
fi
}
function assert_equal() {
[[ "$1" == "$2" ]] || exit_error "$1 is not equal to $2"
}
function shutdown_services() {
echo "Shutting down services"
jobs -p | xargs --no-run-if-empty kill || true

View File

@ -0,0 +1,14 @@
#!/bin/bash
# Script to check that the wallet automatically refreshes coins for they expire
source "common.sh"
normal_start_and_wait "coin-expiration"
echo "Withdraw TESTKUDOS"
taler-wallet-cli --wallet-db="$WALLET_DB" --no-throttle testing withdraw -e "$EXCHANGE_URL" -b "$BANK_URL" -a "TESTKUDOS:10" >>"$LOG" 2>>"$LOG"
echo "Balance after withdrawal: $(get_balance)"
# TODO time-travel to check that wallet actually refreshed coin before expiration
taler-wallet-cli --wallet-db="$WALLET_DB" advanced dump-coins
exit_success

View File

@ -0,0 +1,19 @@
#!/bin/bash
# Script to check that the wallet does a withdrawal correctly
source "common.sh"
normal_start_and_wait "withdrawal"
echo "Withdraw 5 TESTKUDOS"
taler-wallet-cli --wallet-db="$WALLET_DB" --no-throttle testing withdraw -e "$EXCHANGE_URL" -b "$BANK_URL" -a "TESTKUDOS:5" >>"$LOG" 2>>"$LOG"
BALANCE_1=$(get_balance)
assert_equal "$BALANCE_1" "TESTKUDOS:4.84"
echo "Balance after withdrawal: $BALANCE_1"
echo "Withdraw 10 TESTKUDOS"
taler-wallet-cli --wallet-db="$WALLET_DB" --no-throttle testing withdraw -e "$EXCHANGE_URL" -b "$BANK_URL" -a "TESTKUDOS:10" >>"$LOG" 2>>"$LOG"
BALANCE_2=$(get_balance)
assert_equal "$BALANCE_2" "TESTKUDOS:14.66"
echo "Balance after withdrawal: $BALANCE_2"
exit_success