aboutsummaryrefslogtreecommitdiff
path: root/src/testing/taler-unified-setup.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/testing/taler-unified-setup.sh')
-rwxr-xr-xsrc/testing/taler-unified-setup.sh74
1 files changed, 56 insertions, 18 deletions
diff --git a/src/testing/taler-unified-setup.sh b/src/testing/taler-unified-setup.sh
index a52aebff1..1ddc3316e 100755
--- a/src/testing/taler-unified-setup.sh
+++ b/src/testing/taler-unified-setup.sh
@@ -29,19 +29,21 @@ set -eu
# Exit, with status code "skip" (no 'real' failure)
function exit_skip() {
- echo " SKIP: " "$@"
+ echo " SKIP: " "$@" >&2
exit 77
}
# Exit, with error message (hard failure)
function exit_fail() {
- echo " FAIL: " "$@"
+ echo " FAIL: " "$@" >&2
exit 1
}
# Cleanup to run whenever we exit
function cleanup()
{
+ echo "Taler unified setup terminating!" >&2
+
for n in $(jobs -p)
do
kill $n 2> /dev/null || true
@@ -53,6 +55,7 @@ function cleanup()
# Install cleanup handler (except for kill -9)
trap cleanup EXIT
+WAIT_FOR_SIGNAL=0
START_AUDITOR=0
START_BACKUP=0
START_EXCHANGE=0
@@ -71,7 +74,7 @@ LOGLEVEL="DEBUG"
DEFAULT_SLEEP="0.2"
# Parse command-line options
-while getopts ':abc:d:efghl:mnr:stu:vw' OPTION; do
+while getopts ':abc:d:efghl:mnr:stu:vwW' OPTION; do
case "$OPTION" in
a)
START_AUDITOR="1"
@@ -82,7 +85,7 @@ while getopts ':abc:d:efghl:mnr:stu:vw' OPTION; do
c)
CONF_ORIG="$OPTARG"
;;
- c)
+ d)
WIRE_DOMAIN="$OPTARG"
;;
e)
@@ -142,6 +145,9 @@ while getopts ':abc:d:efghl:mnr:stu:vw' OPTION; do
w)
START_WIREWATCH="1"
;;
+ W)
+ WAIT_FOR_SIGNAL="1"
+ ;;
?)
exit_fail "Unrecognized command line option"
;;
@@ -201,22 +207,40 @@ register_sandbox_account() {
demobank \
delete \
--bank-account "$1" &> /dev/null || true
- libeufin-cli sandbox \
- demobank \
- register --name "$3"
+
+ MAYBE_IBAN="${4:-}"
+ if test -n "$MAYBE_IBAN"; then
+ libeufin-cli sandbox \
+ demobank \
+ register --name "$3" --iban "$MAYBE_IBAN"
+ else
+ libeufin-cli sandbox \
+ demobank \
+ register --name "$3"
+ fi
+
unset LIBEUFIN_SANDBOX_USERNAME
unset LIBEUFIN_SANDBOX_PASSWORD
}
-BANK_PORT=$(taler-config -c "$CONF" -s "BANK" -o "HTTP_PORT")
-if [ "1" = "$START_NEXUS" ]
+if [[ "1" = "$START_NEXUS" || "1" = "$START_FAKEBANK" ]]
then
- NEXUS_PORT="$BANK_PORT"
- SANDBOX_PORT="1$BANK_PORT"
+ BANK_PORT=$(taler-config -c "$CONF" -s "BANK" -o "HTTP_PORT")
+ if [ "1" = "$START_NEXUS" ]
+ then
+ NEXUS_PORT="$BANK_PORT"
+ SANDBOX_PORT="1$BANK_PORT"
+ else
+ NEXUS_PORT="0"
+ SANDBOX_PORT="1$BANK_PORT"
+ fi
else
- NEXUS_PORT="0"
- SANDBOX_PORT="1$BANK_PORT"
+ if [ "1" = "$START_SANDBOX" ]
+ then
+ BANK_PORT=$(taler-config -c "$CONF" -s "BANK" -o "HTTP_PORT")
+ SANDBOX_PORT="$BANK_PORT"
+ fi
fi
if [ "1" = "$START_SANDBOX" ]
@@ -256,7 +280,11 @@ then
fi
echo "OK"
echo -n "Register Sandbox users ..."
- register_sandbox_account fortytwo x "Forty Two"
+ # The specified IBAN and name must match the ones hard-coded into
+ # the C helper for the add-incoming call. Without this value,
+ # Sandbox won't find the target account to debit along a /add-incoming
+ # call.
+ register_sandbox_account fortytwo x "User42" FR7630006000011234567890189
register_sandbox_account fortythree x "Forty Three"
register_sandbox_account exchange x "Exchange Company"
register_sandbox_account tor x "Tor Project"
@@ -610,7 +638,7 @@ then
if [ "1" != "$OK" ]
then
cat "$LAST_RESPONSE"
- exit_skip "Failed to setup exchange keys, check secmod logs"
+ exit_fail "Failed to setup exchange keys, check secmod logs"
fi
rm "$LAST_RESPONSE"
echo " OK"
@@ -662,7 +690,7 @@ then
if [ "1" != "$OK" ]
then
cat "$LAST_RESPONSE"
- exit_skip " Failed to setup keys"
+ exit_fail " Failed to setup keys"
fi
rm "$LAST_RESPONSE"
echo " OK"
@@ -681,7 +709,17 @@ fi
# Signal caller that we are ready.
echo "<<READY>>"
-# Wait until caller stops us.
-read
+if [ "1" = "$WAIT_FOR_SIGNAL" ]
+then
+ while true
+ do
+ sleep 0.1
+ done
+else
+ # Wait until caller stops us.
+ read
+fi
+
+echo "Taler unified setup terminating!" >&2
exit 0