aboutsummaryrefslogtreecommitdiff
path: root/src/testing
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2023-01-12 17:47:09 +0100
committerChristian Grothoff <christian@grothoff.org>2023-01-12 17:47:09 +0100
commitbb56da09cbdfcb039183a3fbbdf17e487a17bd53 (patch)
tree6ae438d2f6dc334dd9307ff42aa3e47303a68df0 /src/testing
parent1037add35d361c5b0bf60041496f8d2a23bd1722 (diff)
-fix test cases for new libeufin
Diffstat (limited to 'src/testing')
-rwxr-xr-xsrc/testing/initialize_taler_system.sh2
-rwxr-xr-xsrc/testing/test_merchant_reserve_creation.sh32
2 files changed, 17 insertions, 17 deletions
diff --git a/src/testing/initialize_taler_system.sh b/src/testing/initialize_taler_system.sh
index d78ad1bf..b12ac583 100755
--- a/src/testing/initialize_taler_system.sh
+++ b/src/testing/initialize_taler_system.sh
@@ -51,7 +51,7 @@ function cleanup()
}
NEXUS_PORT=8082
-SANDBOX_URL=http://localhost:1$NEXUS_PORT/demobanks/default
+SANDBOX_URL=http://localhost:1$NEXUS_PORT/
export BANK_URL=$SANDBOX_URL
function get_payto_uri() {
export LIBEUFIN_SANDBOX_USERNAME=$1
diff --git a/src/testing/test_merchant_reserve_creation.sh b/src/testing/test_merchant_reserve_creation.sh
index d3ececb8..b4e23e18 100755
--- a/src/testing/test_merchant_reserve_creation.sh
+++ b/src/testing/test_merchant_reserve_creation.sh
@@ -17,6 +17,8 @@
# <http://www.gnu.org/licenses/>
#
+set -eu
+
. initialize_taler_system.sh
echo -n "Configuring merchant instance ..."
@@ -31,26 +33,23 @@ STATUS=$(curl -H "Content-Type: application/json" -X POST \
if [ "$STATUS" != "204" ]
then
- echo 'should respond ok, instance created. got:' $STATUS
+ echo 'Expected 204, instance created. Got instead: ' $STATUS
exit 1
fi
+echo "OK"
-echo OK
-
-echo -n "creating reserve ..."
-
+echo -n "Creating reserve ..."
STATUS=$(curl 'http://localhost:9966/instances/default/private/reserves' \
-d '{"initial_balance":"TESTKUDOS:2","exchange_url":"'$EXCHANGE_URL'","wire_method":"iban"}' \
-w "%{http_code}" -s -o $LAST_RESPONSE)
-
if [ "$STATUS" != "200" ]
then
- echo 'should respond ok, reserve created. got:' $STATUS
+ echo 'Expected 200, reserve created. Got instead: ' $STATUS
exit 1
fi
-echo OK
+echo "OK"
RESERVE_PUB=`jq -r .reserve_pub < $LAST_RESPONSE`
@@ -61,35 +60,36 @@ FUNDED=`jq -r '.merchant_initial_amount == .exchange_initial_amount' < $LAST_RES
if [ "$FUNDED" != "false" ]
then
- echo 'should not be funded if we just created. got:' $STATUS 'is founded: ' $FUNDED
+ echo 'Should not yet be funded if we just created. Got:' $STATUS 'is founded: ' $FUNDED
cat $LAST_RESPONSE
exit 1
fi
-echo -n Wire transferring...
+echo -n "Wire transferring... "
# Exchange wants TESTKUDOS:2 from account 43, under RESERVE_PUB.
EXCHANGE_PAYTO=`get_payto_uri exchange x`
export LIBEUFIN_SANDBOX_USERNAME=fortythree
export LIBEUFIN_SANDBOX_PASSWORD=x
-export LIBEUFIN_SANDBOX_URL=http://localhost:18082/demobanks/default
+export LIBEUFIN_SANDBOX_URL="http://localhost:18082/"
libeufin-cli sandbox demobank new-transaction \
--bank-account fortythree \
--payto-with-subject "$EXCHANGE_PAYTO&message=$RESERVE_PUB" \
- --amount 2 # Currency taken from the demobank config.
+ --amount TESTKUDOS:2
unset LIBEUFIN_SANDBOX_USERNAME
unset LIBEUFIN_SANDBOX_PASSWORD
unset LIBEUFIN_SANDBOX_URL
-echo -n "Give background tasks time to detect the payment..."
-sleep 4
-echo " OK"
+echo "OK"
+echo -n "Give Nexus time to detect the payment... "
+sleep 10 # FIXME-MS: replace with call to Nexus to right now poll the sandbox ...
+echo "OK"
# Stop existing background service, we need to run it here, now, and only once
kill -TERM $WIREWATCH_PID
wait $WIREWATCH_PID
-taler-exchange-wirewatch -c $CONF -t -L INFO
+taler-exchange-wirewatch -c $CONF -t -L INFO &> taler-exchange-wirewatch.log
STATUS=$(curl 'http://localhost:9966/instances/default/private/reserves/'$RESERVE_PUB \
-w "%{http_code}" -s -o $LAST_RESPONSE)