summaryrefslogtreecommitdiff
path: root/src/bank-lib/test_bank.sh
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-08-07 17:50:53 +0200
committerChristian Grothoff <christian@grothoff.org>2021-08-07 17:50:53 +0200
commit8a60e6b62f173c1148686572e72ad552c3808325 (patch)
tree25db5bba3c0fe4df518d1bc601aeea28ecc458dc /src/bank-lib/test_bank.sh
parent26e061c2128666fcbdfb94d92343ec12599a59a1 (diff)
downloadexchange-8a60e6b62f173c1148686572e72ad552c3808325.tar.gz
exchange-8a60e6b62f173c1148686572e72ad552c3808325.tar.bz2
exchange-8a60e6b62f173c1148686572e72ad552c3808325.zip
-fix fakebank/tewgc logic and add test case
Diffstat (limited to 'src/bank-lib/test_bank.sh')
-rwxr-xr-xsrc/bank-lib/test_bank.sh74
1 files changed, 74 insertions, 0 deletions
diff --git a/src/bank-lib/test_bank.sh b/src/bank-lib/test_bank.sh
new file mode 100755
index 000000000..694fb82f3
--- /dev/null
+++ b/src/bank-lib/test_bank.sh
@@ -0,0 +1,74 @@
+#!/bin/bash
+
+set -eu
+
+# Cleanup to run whenever we exit
+function cleanup()
+{
+ for n in `jobs -p`
+ do
+ kill $n 2> /dev/null || true
+ done
+ wait
+}
+
+# Install cleanup handler (except for kill -9)
+trap cleanup EXIT
+
+echo -n "Launching bank..."
+
+taler-fakebank-run -c test_bank.conf -L DEBUG &> bank.log &
+
+# Wait for bank to be available (usually the slowest)
+for n in `seq 1 50`
+do
+ echo -n "."
+ sleep 0.2
+ OK=0
+ # bank
+ wget --tries=1 --timeout=1 http://localhost:8899/ -o /dev/null -O /dev/null >/dev/null || continue
+ OK=1
+ break
+done
+
+if [ 1 != $OK ]
+then
+ exit_skip "Failed to launch services (bank)"
+fi
+
+echo "OK"
+
+echo -n "Making wire transfer to exchange ..."
+
+taler-exchange-wire-gateway-client \
+ -b http://localhost:8899/exchange/ \
+ -S 0ZSX8SH0M30KHX8K3Y1DAMVGDQV82XEF9DG1HC4QMQ3QWYT4AF00 \
+ -D payto://x-taler-bank/localhost:8899/user \
+ -a TESTKUDOS:4 > /dev/null
+echo " OK"
+
+echo -n "Requesting exchange incoming transaction list ..."
+
+./taler-exchange-wire-gateway-client -b http://localhost:8899/exchange/ -i | grep TESTKUDOS:4 > /dev/null
+
+echo " OK"
+
+echo -n "Making wire transfer from exchange..."
+
+./taler-exchange-wire-gateway-client \
+ -b http://localhost:8899/exchange/ \
+ -S 0ZSX8SH0M30KHX8K3Y1DAMVGDQV82XEF9DG1HC4QMQ3QWYT4AF00 \
+ -C payto://x-taler-bank/localhost:8899/merchant \
+ -a TESTKUDOS:2 > /dev/null
+echo " OK"
+
+
+echo -n "Requesting exchange's outgoing transaction list..."
+
+./taler-exchange-wire-gateway-client -b http://localhost:8899/exchange/ -o | grep TESTKUDOS:2 > /dev/null
+
+echo " OK"
+
+echo "All tests passed"
+
+exit 0