From 732008af40f975f98cc84598b4025e6194915718 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 26 Aug 2021 20:55:07 +0200 Subject: -use temporary file when editing configs --- src/testing/test_prepare.sh | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) (limited to 'src/testing') diff --git a/src/testing/test_prepare.sh b/src/testing/test_prepare.sh index 5faee2e..035a588 100755 --- a/src/testing/test_prepare.sh +++ b/src/testing/test_prepare.sh @@ -24,7 +24,7 @@ function cleanup() do kill $n 2> /dev/null || true done - rm -rf $CONF $WALLET_DB $R1FILE $R2FILE $B1FILE $B2FILE $TMP_DIR + rm -rf $CONF $CONF4 $WALLET_DB $R1FILE $R2FILE $B1FILE $B2FILE $TMP_DIR wait } @@ -131,7 +131,9 @@ fi # Exchange configuration file will be edited, so we create one # from the template. CONF=`mktemp test_reducerXXXXXX.conf` +CONF4=`mktemp test_reducer_4XXXXXX.conf` cp test_reducer.conf $CONF +cp $CONF_4 $CONF4 TMP_DIR=`mktemp -d keys-tmp-XXXXXX` WALLET_DB=`mktemp test_reducer_walletXXXXXX.json` @@ -165,8 +167,8 @@ echo -n "Testing for libeufin-cli" if libeufin-cli --version > /dev/null then echo " FOUND" - IBAN_CREDIT=`anastasis-config -c $CONF_4 -s authorization-iban -o CREDIT_IBAN` - CREDIT_BUSINESS_NAME=`anastasis-config -c $CONF_4 -s authorization-iban -o BUSINESS_NAME` + IBAN_CREDIT=`anastasis-config -c $CONF4 -s authorization-iban -o CREDIT_IBAN` + CREDIT_BUSINESS_NAME=`anastasis-config -c $CONF4 -s authorization-iban -o BUSINESS_NAME` echo -n "Setting up Nexus ..." export LIBEUFIN_NEXUS_DB_CONNECTION="jdbc:sqlite:$(mktemp -u /tmp/nexus-db-XXXXXX.sqlite)" export LIBEUFIN_SANDBOX_DB_CONNECTION="jdbc:sqlite:$(mktemp -u /tmp/sandbox-db-XXXXXX.sqlite)" @@ -255,35 +257,42 @@ then ## Reach facade with: $FACADE_URL + $CREDIT_USERNAME + $CREDIT_PASSWORD echo -n "Configuring Anastasis IBAN account ..." - anastasis-config -c $CONF_4 \ + anastasis-config -c $CONF4 \ -s authorization-iban \ -o CREDIT_IBAN \ -V "${IBAN_CREDIT}" - anastasis-config -c $CONF_4 \ + anastasis-config -c $CONF4 \ -s authorization-iban \ -o BUSINESS_NAME \ -V "${PERSON_CREDIT_NAME}" - anastasis-config -c $CONF_4 \ + anastasis-config -c $CONF4 \ -s authorization-iban \ -o WIRE_GATEWAY_URL \ -V "${FACADE_URL}" - anastasis-config -c $CONF_4 \ + anastasis-config -c $CONF4 \ -s authorization-iban \ -o WIRE_GATEWAY_AUTH_METHOD \ -V "basic" - anastasis-config -c $CONF_4 \ + anastasis-config -c $CONF4 \ -s authorization-iban \ -o USERNAME \ -V "${LIBEUFIN_NEXUS_USERNAME}" - anastasis-config -c $CONF_4 \ + anastasis-config -c $CONF4 \ -s authorization-iban \ -o PASSWORD \ -V "${LIBEUFIN_NEXUS_PASSWORD}" + anastasis-config -c $CONF4 \ + -s authorization-iban \ + -o ENABLED \ + -V YES echo " OK" IBAN_ACTIVE='true' else echo " NOT FOUND (IBAN authentication not supported)" - anastasis-config -c $CONF_4 -s authorization-iban -o ENABLED -V no + anastasis-config -c $CONF4 \ + -s authorization-iban \ + -o ENABLED \ + -V NO fi @@ -298,7 +307,7 @@ echo -n "Initialize anastasis database ..." TARGET_DB_1=`anastasis-config -c $CONF_1 -s stasis-postgres -o CONFIG | sed -e "s/^postgres:\/\/\///"` TARGET_DB_2=`anastasis-config -c $CONF_2 -s stasis-postgres -o CONFIG | sed -e "s/^postgres:\/\/\///"` TARGET_DB_3=`anastasis-config -c $CONF_3 -s stasis-postgres -o CONFIG | sed -e "s/^postgres:\/\/\///"` -TARGET_DB_4=`anastasis-config -c $CONF_4 -s stasis-postgres -o CONFIG | sed -e "s/^postgres:\/\/\///"` +TARGET_DB_4=`anastasis-config -c $CONF4 -s stasis-postgres -o CONFIG | sed -e "s/^postgres:\/\/\///"` dropdb $TARGET_DB_1 >/dev/null 2>/dev/null || true createdb $TARGET_DB_1 || exit_skip "Could not create database $TARGET_DB_1" @@ -311,7 +320,7 @@ createdb $TARGET_DB_3 || exit_skip "Could not create database $TARGET_DB_3" anastasis-dbinit -c $CONF_3 2> anastasis-dbinit_3.log dropdb $TARGET_DB_4 >/dev/null 2>/dev/null || true createdb $TARGET_DB_4 || exit_skip "Could not create database $TARGET_DB_4" -anastasis-dbinit -c $CONF_4 2> anastasis-dbinit_4.log +anastasis-dbinit -c $CONF4 2> anastasis-dbinit_4.log echo " OK" @@ -387,7 +396,7 @@ PREFIX="" $PREFIX anastasis-httpd -L INFO -c $CONF_1 2> anastasis-httpd_1.log & $PREFIX anastasis-httpd -L INFO -c $CONF_2 2> anastasis-httpd_2.log & $PREFIX anastasis-httpd -L INFO -c $CONF_3 2> anastasis-httpd_3.log & -$PREFIX anastasis-httpd -L INFO -c $CONF_4 2> anastasis-httpd_4.log & +$PREFIX anastasis-httpd -L INFO -c $CONF4 2> anastasis-httpd_4.log & if test $1 = 'fees' @@ -529,6 +538,7 @@ echo '- to terminate the test environment by leaving the sub-shell use: exit' if test $IBAN_ACTIVE = 'true' then echo '- for IBAN authentication use: wire_transfer_to_anastasis "$AMOUNT" "$SUBJECT"' + echo "- for your customer IBAN, use: ${IBAN_DEBIT}" fi if test $1 = 'fees' then -- cgit v1.2.3