gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] 01/02: -fix auditor tests (mostly)


From: gnunet
Subject: [taler-exchange] 01/02: -fix auditor tests (mostly)
Date: Tue, 23 Aug 2022 20:43:15 +0200

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

grothoff pushed a commit to branch master
in repository exchange.

commit e96cf9ba66fb2dc96a5e09ef49fa8e8a38700338
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Tue Aug 23 20:40:26 2022 +0200

    -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 ++++++++++++--------
 src/exchange-tools/taler-exchange-offline.c       |  3 +++
 6 files changed, 29 insertions(+), 16 deletions(-)

diff --git a/src/auditor/auditor-basedb.conf b/src/auditor/auditor-basedb.conf
index be122c7d..71e76297 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 1d18740c..00000000
--- 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 6096a3fc..396f85cf 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 || exit_skip " MISSING"
 echo " FOUND"
@@ -92,11 +93,12 @@ createdb $TARGET_DB || exit_skip "Could not create database 
$TARGET_DB"
 
 
 # obtain key configuration data
-MASTER_PRIV_FILE=`taler-config -f -c $CONF_ONCE -s exchange-offline -o 
MASTER_PRIV_FILE`
+MASTER_PRIV_FILE=${TARGET_DB}.mpriv
+taler-config -f -c ${CONF_ONCE} -s exchange-offline -o MASTER_PRIV_FILE -V 
${MASTER_PRIV_FILE}
 MASTER_PRIV_DIR=`dirname $MASTER_PRIV_FILE`
+rm -f "${MASTER_PRIV_FILE}"
 mkdir -p $MASTER_PRIV_DIR
 gnunet-ecc -g1 $MASTER_PRIV_FILE > /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 4c83d2ec..3832876d 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 || exit_skip " MISSING"
@@ -73,9 +73,11 @@ createdb $TARGET_DB || exit_skip "Could not create database 
$TARGET_DB"
 rm $TARGET_DB >/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 2e847564..f965558f 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
diff --git a/src/exchange-tools/taler-exchange-offline.c 
b/src/exchange-tools/taler-exchange-offline.c
index 839b8e22..60a39df9 100644
--- a/src/exchange-tools/taler-exchange-offline.c
+++ b/src/exchange-tools/taler-exchange-offline.c
@@ -987,6 +987,9 @@ load_offline_key (int do_create)
   GNUNET_free (fn);
   GNUNET_CRYPTO_eddsa_key_get_public (&master_priv.eddsa_priv,
                                       &master_pub.eddsa_pub);
+  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+              "Using master public key %s\n",
+              TALER_B2S (&master_pub));
   done = true;
   return GNUNET_OK;
 }

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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