From 381c3919957e3dad2ad90bd5a971524f3e70a81d Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 2 Sep 2023 18:39:23 +0200 Subject: fix issues in test_iban.sh --- src/cli/test_iban.sh | 49 ++++++++++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/src/cli/test_iban.sh b/src/cli/test_iban.sh index c80c3a2..207d2d5 100755 --- a/src/cli/test_iban.sh +++ b/src/cli/test_iban.sh @@ -21,9 +21,9 @@ function cleanup() { for n in $(jobs -p) do - kill $n 2> /dev/null || true + kill "$n" 2> /dev/null || true done - rm -rf $CONF $R1FILE $R2FILE $B1FILE $B2FILE + rm -rf "$CONF" "$R1FILE" "$R2FILE" "$B1FILE" "$B2FILE" wait } @@ -31,17 +31,17 @@ function cleanup() # $1=ebics username, $2=ebics partner name, $3=person name, $4=sandbox bank account name, $5=iban function prepare_sandbox_account() { echo -n "Registering $4 to the Sandbox..." - export LIBEUFIN_SANDBOX_USERNAME=$4 + export LIBEUFIN_SANDBOX_USERNAME="$4" export LIBEUFIN_SANDBOX_PASSWORD=unused - libeufin-cli sandbox --sandbox-url=$SANDBOX_URL \ - demobank register --name "$3" --iban $5 + libeufin-cli sandbox --sandbox-url="$SANDBOX_URL" \ + demobank register --name "$3" --iban "$5" echo " OK" echo -n "Associating a EBICS subscriber to $4..." export LIBEUFIN_SANDBOX_USERNAME=admin - libeufin-cli sandbox --sandbox-url=$SANDBOX_URL demobank new-ebicssubscriber \ - --host-id $EBICS_HOST \ - --user-id $1 --partner-id $2 \ - --bank-account $4 # that's a username _and_ a bank account name + libeufin-cli sandbox --sandbox-url="$SANDBOX_URL" demobank new-ebicssubscriber \ + --host-id "$EBICS_HOST" \ + --user-id "$1" --partner-id "$2" \ + --bank-account "$4" # that's a username _and_ a bank account name echo " OK" unset LIBEUFIN_SANDBOX_USERNAME @@ -96,6 +96,9 @@ function wire_transfer_to_anastasis() { --debit-account=sandbox-account-debit \ --credit-account=sandbox-account-credit "$1" "$2" &> libeufin-transfer-initiate.out echo " OK" + # FIXME-MS: the following command reports that it did not + # sync any transactions, even though presumably we just + # made one in the one above (which succeeded...) echo -n "Syncing nexus with sandbox ..." export LIBEUFIN_NEXUS_USERNAME="$CREDIT_USERNAME" export LIBEUFIN_NEXUS_PASSWORD="$CREDIT_PASSWORD" @@ -136,6 +139,8 @@ function prepare_nexus_account() { CONF=$(mktemp test_free_reducerXXXXXX.conf) cp test_free_reducer.conf "$CONF" + + B1FILE=$(mktemp test_reducer_stateB1XXXXXX) B2FILE=$(mktemp test_reducer_stateB2XXXXXX) R1FILE=$(mktemp test_reducer_stateR1XXXXXX) @@ -167,6 +172,20 @@ echo -n "Testing for anastasis-reducer ..." anastasis-reducer -h > /dev/null || exit_skip "anastasis-reducer required" echo " FOUND" +echo -n "Initialize Anastasis database ..." +# Name of the Postgres database we will use for the script. +# Will be dropped, do NOT use anything that might be used +# elsewhere + +TARGET_DB=$(anastasis-config -c "$CONF" -s stasis-postgres -o CONFIG | sed -e "s/^postgres:\/\/\///") + +dropdb "$TARGET_DB" >/dev/null 2>/dev/null || true +createdb "$TARGET_DB" || exit_skip "Could not create database $TARGET_DB" +anastasis-dbinit -c "$CONF" 2> anastasis-dbinit.log + +echo " OK" + + export LIBEUFIN_NEXUS_DB_CONNECTION="postgres:///anastasischeck" export LIBEUFIN_SANDBOX_DB_CONNECTION="postgres:///anastasischeck" NEXUS_URL="http://localhost:5001/" @@ -257,18 +276,6 @@ FACADE_URL=$(libeufin-cli facades list | jq .facades[0].baseUrl | tr -d \") ## Reach facade with: $FACADE_URL + $CREDIT_USERNAME + $CREDIT_PASSWORD -echo -n "Initialize Anastasis database ..." -# Name of the Postgres database we will use for the script. -# Will be dropped, do NOT use anything that might be used -# elsewhere - -TARGET_DB=$(anastasis-config -c "$CONF" -s stasis-postgres -o CONFIG | sed -e "s/^postgres:\/\/\///") - -dropdb "$TARGET_DB" >/dev/null 2>/dev/null || true -createdb "$TARGET_DB" || exit_skip "Could not create database $TARGET_DB" -anastasis-dbinit -c "$CONF" 2> anastasis-dbinit.log - -echo " OK" echo -n "Configuring Anastasis IBAN account ..." anastasis-config -c "$CONF" \ -- cgit v1.2.3