-fix auditor tests (mostly)

This commit is contained in:
Christian Grothoff 2022-08-23 20:40:26 +02:00
parent a8076ec01e
commit e96cf9ba66
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
6 changed files with 29 additions and 16 deletions

View File

@ -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/

View File

@ -1 +0,0 @@
@INLINE@ generate-auditor-basedb.conf

View File

@ -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

View File

@ -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`

View File

@ -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

View File

@ -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;
}