gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-wallet-core] branch master updated: integration test for handling


From: gnunet
Subject: [taler-wallet-core] branch master updated: integration test for handling the same pay URI multiple times
Date: Wed, 06 May 2020 21:06:09 +0200

This is an automated email from the git hooks/post-receive script.

torsten-grote pushed a commit to branch master
in repository wallet-core.

The following commit(s) were added to refs/heads/master by this push:
     new b7c75bd5 integration test for handling the same pay URI multiple times
b7c75bd5 is described below

commit b7c75bd56a484efcf77210f1541cda67e2a90f61
Author: Torsten Grote <address@hidden>
AuthorDate: Wed May 6 16:05:38 2020 -0300

    integration test for handling the same pay URI multiple times
---
 integrationtests/common.sh           | 11 ++++++++---
 integrationtests/test-base.sh        |  2 --
 integrationtests/test-double-link.sh | 26 ++++++++++++++++++++++++++
 integrationtests/test-recoup.sh      |  1 -
 4 files changed, 34 insertions(+), 6 deletions(-)

diff --git a/integrationtests/common.sh b/integrationtests/common.sh
index 82b3a129..0104dbc9 100644
--- a/integrationtests/common.sh
+++ b/integrationtests/common.sh
@@ -14,8 +14,8 @@ function setup_config() {
     [[ "$(taler-merchant-httpd -v)" =~ "taler-merchant-httpd v" ]]  || 
exit_skip " MISSING"
     echo " FOUND"
 
-    trap 'jobs -p | xargs kill &> /dev/null || true' ERR
-    trap 'jobs -p | xargs kill &> /dev/null || true' EXIT
+    trap shutdown_services ERR
+    trap shutdown_services EXIT
 
     SCRIPT_NAME=$1
 
@@ -135,7 +135,7 @@ function wait_for_services() {
 
 function shutdown_services() {
     echo "Shutting down services"
-    jobs -p | xargs kill
+    jobs -p | xargs --no-run-if-empty kill || true
     wait
 
     # clean up
@@ -151,3 +151,8 @@ function exit_skip() {
     echo "$1"
     exit 77
 }
+
+function exit_error() {
+    echo "Error: $1"
+    exit 1
+}
diff --git a/integrationtests/test-base.sh b/integrationtests/test-base.sh
index 45554f0b..337d8b13 100755
--- a/integrationtests/test-base.sh
+++ b/integrationtests/test-base.sh
@@ -13,6 +13,4 @@ wait_for_services
 echo "Running wallet"
 taler-wallet-cli testing integrationtest -e "$EXCHANGE_URL" -m "$MERCHANT_URL" 
-b "$BANK_URL"
 
-shutdown_services
-
 exit 0
diff --git a/integrationtests/test-double-link.sh 
b/integrationtests/test-double-link.sh
new file mode 100755
index 00000000..75de484c
--- /dev/null
+++ b/integrationtests/test-double-link.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+# Script to check that Uris are properly handled when used a second time
+
+source "common.sh"
+setup_config "double-link"
+setup_services
+launch_services
+wait_for_services
+
+WALLET_DB=wallet-double-link.json
+
+echo "Getting pay taler:// Uri"
+PAY_URI=$(taler-wallet-cli testing gen-pay-uri -m "$MERCHANT_URL" -k sandbox 
-a "TESTKUDOS:1" -s "foo" | grep -E -o 'taler://.*')
+echo "Trying to pay without balance"
+taler-wallet-cli --wallet-db=$WALLET_DB --no-throttle handle-uri --yes 
"$PAY_URI" 2>&1 | grep -q "insufficient balance" || exit_error "not reporting 
insufficient balance"
+echo "Withdrawing"
+taler-wallet-cli --wallet-db=$WALLET_DB --no-throttle testing withdraw -e 
"$EXCHANGE_URL" -b "$BANK_URL" -a "TESTKUDOS:10" > /dev/null
+echo "Trying to pay again, should work this time"
+taler-wallet-cli --wallet-db=$WALLET_DB --no-throttle handle-uri --yes 
"$PAY_URI" > /dev/null
+echo "Trying to pay what was paid already should throw error"
+taler-wallet-cli --wallet-db=$WALLET_DB --no-throttle handle-uri --yes 
"$PAY_URI" 2>&1 | grep -q "already paid" || exit_error "not reporting already 
paid"
+echo "Already paid properly detected"
+
+rm $WALLET_DB || true
+
+exit 0
diff --git a/integrationtests/test-recoup.sh b/integrationtests/test-recoup.sh
index ea4d9380..938a8506 100755
--- a/integrationtests/test-recoup.sh
+++ b/integrationtests/test-recoup.sh
@@ -175,7 +175,6 @@ taler-wallet-cli $TIMETRAVEL --wallet-db=$WALLET_DB 
run-until-done
 
 echo "Bought something with refresh-recouped coin"
 
-shutdown_services
 rm -r "$TMP_DIR"
 
 exit 0

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]