From e96cf9ba66fb2dc96a5e09ef49fa8e8a38700338 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 23 Aug 2022 20:40:26 +0200 Subject: -fix auditor tests (mostly) --- src/auditor/auditor-basedb.conf | 4 +++- src/auditor/generate-auditor-basedb-template.conf | 1 - src/auditor/generate-auditor-basedb.sh | 9 ++++++--- src/auditor/generate-revoke-basedb.sh | 8 +++++--- src/auditor/test-auditor.sh | 20 ++++++++++++-------- 5 files changed, 26 insertions(+), 16 deletions(-) delete mode 100644 src/auditor/generate-auditor-basedb-template.conf (limited to 'src/auditor') diff --git a/src/auditor/auditor-basedb.conf b/src/auditor/auditor-basedb.conf index be122c7d5..71e76297e 100644 --- a/src/auditor/auditor-basedb.conf +++ b/src/auditor/auditor-basedb.conf @@ -1,3 +1,6 @@ +[exchange-offline] +MASTER_PRIV_FILE = auditor-basedb.mpriv + [instance-default] KEYFILE = ${TALER_DATA_HOME}/merchant/default.priv NAME = Merchant Inc. @@ -184,4 +187,3 @@ TALER_CACHE_HOME = $TALER_HOME/.cache/taler/ TALER_CONFIG_HOME = $TALER_HOME/.config/taler/ TALER_DATA_HOME = $TALER_HOME/.local/share/taler/ TALER_HOME = ${PWD}/generate_auditordb_home/ - diff --git a/src/auditor/generate-auditor-basedb-template.conf b/src/auditor/generate-auditor-basedb-template.conf deleted file mode 100644 index 1d18740c7..000000000 --- a/src/auditor/generate-auditor-basedb-template.conf +++ /dev/null @@ -1 +0,0 @@ -@INLINE@ generate-auditor-basedb.conf diff --git a/src/auditor/generate-auditor-basedb.sh b/src/auditor/generate-auditor-basedb.sh index 6096a3fc2..396f85cfa 100755 --- a/src/auditor/generate-auditor-basedb.sh +++ b/src/auditor/generate-auditor-basedb.sh @@ -69,6 +69,7 @@ rm -f $TARGET_DB # from the template. CONF_ONCE=${BASEDB}.conf cp generate-auditor-basedb.conf $CONF_ONCE +taler-config -c ${CONF_ONCE} -s exchange-offline -o MASTER_PRIV_FILE -V ${BASEDB}.mpriv echo -n "Testing for libeufin" libeufin-cli --help >/dev/null /dev/null -cp $MASTER_PRIV_FILE ${BASEDB}.mpriv MASTER_PUB=`gnunet-ecc -p $MASTER_PRIV_FILE` MERCHANT_PORT=`taler-config -c $CONF_ONCE -s MERCHANT -o PORT` MERCHANT_URL=http://localhost:${MERCHANT_PORT}/ @@ -110,7 +112,8 @@ EXCHANGE_URL=`taler-config -c $CONF_ONCE -s EXCHANGE -o BASE_URL` BANK_PORT=`taler-config -c $CONF_ONCE -s BANK -o HTTP_PORT` BANK_URL="http://localhost:1${BANK_PORT}/demobanks/default" -echo "AUDITOR PUB is $AUDITOR_PUB using file $AUDITOR_PRIV_FILE" +echo "MASTER PUB is ${MASTER_PUB} using file ${MASTER_PRIV_FILE}" +echo "AUDITOR PUB is ${AUDITOR_PUB} using file ${AUDITOR_PRIV_FILE}" # patch configuration taler-config -c $CONF_ONCE -s exchange -o MASTER_PUBLIC_KEY -V $MASTER_PUB diff --git a/src/auditor/generate-revoke-basedb.sh b/src/auditor/generate-revoke-basedb.sh index 4c83d2ecf..3832876d8 100755 --- a/src/auditor/generate-revoke-basedb.sh +++ b/src/auditor/generate-revoke-basedb.sh @@ -49,9 +49,9 @@ rm -f $WALLET_DB # Configuration file will be edited, so we create one # from the template. -export CONF=generate-auditor-basedb-revocation.conf +export CONF=${BASEDB}.conf cp generate-auditor-basedb.conf $CONF - +taler-config -c ${CONF} -s exchange-offline -o MASTER_PRIV_FILE -V ${BASEDB}.mpriv echo -n "Testing for libeufin(-cli)" libeufin-cli --help >/dev/null /dev/null 2>/dev/null || true # libeufin # obtain key configuration data -MASTER_PRIV_FILE=`taler-config -f -c $CONF -s exchange-offline -o MASTER_PRIV_FILE` +MASTER_PRIV_FILE=${TARGET_DB}.priv +taler-config -f -c $CONF -s exchange-offline -o MASTER_PRIV_FILE -V ${MASTER_PRIV_FILE} MASTER_PRIV_DIR=`dirname $MASTER_PRIV_FILE` mkdir -p $MASTER_PRIV_DIR +rm -f "${MASTER_PRIV_FILE}" gnunet-ecc -g1 $MASTER_PRIV_FILE > /dev/null export MASTER_PUB=`gnunet-ecc -p $MASTER_PRIV_FILE` export EXCHANGE_URL=`taler-config -c $CONF -s EXCHANGE -o BASE_URL` diff --git a/src/auditor/test-auditor.sh b/src/auditor/test-auditor.sh index 2e847564f..f965558f9 100755 --- a/src/auditor/test-auditor.sh +++ b/src/auditor/test-auditor.sh @@ -211,13 +211,10 @@ function run_audit () { pre_audit ${1:-no} if test ${2:-no} = "drain" then - echo -n "Running taler-exchange-offline drain with master public key " - gnunet-ecc -p ${DB}.mpriv - cp "${CONF}" "${CONF}.tmp" - taler-config -c "${CONF}.tmp" -s exchange-offline -o MASTER_PRIV_FILE -V ${DB}.mpriv echo -n "Starting exchange..." - taler-exchange-httpd -c "${CONF}.tmp" -L INFO 2> exchange-httpd-drain.err & + taler-exchange-httpd -c "${CONF}" -L INFO 2> exchange-httpd-drain.err & EPID=$! + # Wait for all services to be available for n in `seq 1 50` do @@ -230,13 +227,20 @@ function run_audit () { break done echo "... DONE." - taler-exchange-offline -L DEBUG -c "${CONF}.tmp" \ + export CONF + MASTER_PRIV_FILE=`taler-config -f -c ${CONF} -s exchange-offline -o MASTER_PRIV_FILE` + MASTER_PUB=`gnunet-ecc -p $MASTER_PRIV_FILE` + + echo "MASTER PUB is ${MASTER_PUB} using file ${MASTER_PRIV_FILE}" + + echo -n "Running taler-exchange-offline drain " + + taler-exchange-offline -L DEBUG -c "${CONF}" \ drain TESTKUDOS:0.1 exchange-account-1 payto://iban/SANDBOXX/DE360679?receiver-name=Exchange+Drain \ upload \ 2> taler-exchange-offline-drain.log || exit_fail "offline draining failed" kill -TERM $EPID wait $EPID - rm -f "${CONF}.tmp" echo -n "Running taler-exchange-drain ..." echo "\n" | taler-exchange-drain -L DEBUG -c $CONF 2> taler-exchange-drain.log || exit_fail "FAIL" echo " DONE" @@ -249,7 +253,7 @@ function run_audit () { export LIBEUFIN_NEXUS_PASSWORD=x export LIBEUFIN_NEXUS_URL=http://localhost:8082/ PAIN_UUID=`libeufin-cli accounts list-payments exchange-nexus | jq .initiatedPayments[] | jq 'select(.submitted==false)' | jq -r .paymentInitiationId` - libeufin-cli accounts submit-payments --payment-uuid $PAIN_UUID exchange-nexus + libeufin-cli accounts submit-payments --payment-uuid ${PAIN_UUID} exchange-nexus fi audit_only -- cgit v1.2.3