-fix test-auditor.sh

This commit is contained in:
Christian Grothoff 2022-09-13 12:19:02 +02:00
parent 0a618f77cd
commit fed7102ad5
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
7 changed files with 95 additions and 321 deletions

View File

@ -202,10 +202,7 @@ EXTRA_DIST = \
auditor.conf \
test-sync-in.conf \
test-sync-out.conf \
auditor-basedb.conf \
revoke-basedb.conf \
generate-auditor-basedb.sh \
generate-revoke-basedb.sh \
generate-auditor-basedb.conf \
generate-auditor-basedb-template.conf \
generate-revoke-basedb.sh \
$(check_SCRIPTS)

View File

@ -1,189 +0,0 @@
[exchange-offline]
MASTER_PRIV_FILE = auditor-basedb.mpriv
[instance-default]
KEYFILE = ${TALER_DATA_HOME}/merchant/default.priv
NAME = Merchant Inc.
[exchange-account-1]
PAYTO_URI = payto://iban/SANDBOXX/DE989651?receiver-name=Exchange+Company
enable_debit = yes
enable_credit = yes
[exchange-accountcredentials-1]
WIRE_GATEWAY_URL = http://localhost:8082/facades/test-facade/taler-wire-gateway/
WIRE_GATEWAY_AUTH_METHOD = basic
USERNAME = exchange
PASSWORD = x
[merchant-account-merchant]
PAYTO_URI = payto://x-taler-bank/localhost/42
HONOR_default = YES
ACTIVE_default = YES
[merchant-exchange-default]
MASTER_KEY = RKNMPRGXCX35H11WEYXDXYHPR7NX2QK9BG15MT0QEF75PC5KR470
EXCHANGE_BASE_URL = http://localhost:8081/
CURRENCY = TESTKUDOS
[payments-generator]
currency = TESTKUDOS
instance = default
bank = http://localhost:8082/
merchant = http://localhost:9966/
exchange_admin = http://localhost:18080/
exchange-admin = http://localhost:18080/
exchange = http://localhost:8081/
[coin_kudos_ct_1]
value = TESTKUDOS:0.01
duration_withdraw = 7 days
duration_spend = 2 years
duration_legal = 3 years
fee_withdraw = TESTKUDOS:0.01
fee_deposit = TESTKUDOS:0.01
fee_refresh = TESTKUDOS:0.01
fee_refund = TESTKUDOS:0.01
CIPHER = RSA
rsa_keysize = 1024
[coin_kudos_ct_10]
value = TESTKUDOS:0.10
duration_withdraw = 7 days
duration_spend = 2 years
duration_legal = 3 years
fee_withdraw = TESTKUDOS:0.01
fee_deposit = TESTKUDOS:0.01
fee_refresh = TESTKUDOS:0.03
fee_refund = TESTKUDOS:0.01
CIPHER = RSA
rsa_keysize = 1024
[coin_kudos_1]
value = TESTKUDOS:1
duration_withdraw = 7 days
duration_spend = 2 years
duration_legal = 3 years
fee_withdraw = TESTKUDOS:0.02
fee_deposit = TESTKUDOS:0.02
fee_refresh = TESTKUDOS:0.03
fee_refund = TESTKUDOS:0.01
CIPHER = RSA
rsa_keysize = 1024
[coin_kudos_2]
value = TESTKUDOS:2
duration_withdraw = 7 days
duration_spend = 2 years
duration_legal = 3 years
fee_withdraw = TESTKUDOS:0.03
fee_deposit = TESTKUDOS:0.03
fee_refresh = TESTKUDOS:0.04
fee_refund = TESTKUDOS:0.02
CIPHER = RSA
rsa_keysize = 1024
[coin_kudos_4]
value = TESTKUDOS:4
duration_withdraw = 7 days
duration_spend = 2 years
duration_legal = 3 years
fee_withdraw = TESTKUDOS:0.03
fee_deposit = TESTKUDOS:0.03
fee_refresh = TESTKUDOS:0.04
fee_refund = TESTKUDOS:0.02
CIPHER = RSA
rsa_keysize = 1024
[coin_kudos_5]
value = TESTKUDOS:5
duration_withdraw = 7 days
duration_spend = 2 years
duration_legal = 3 years
fee_withdraw = TESTKUDOS:0.01
fee_deposit = TESTKUDOS:0.01
fee_refresh = TESTKUDOS:0.03
fee_refund = TESTKUDOS:0.01
CIPHER = RSA
rsa_keysize = 1024
[coin_kudos_8]
value = TESTKUDOS:8
duration_withdraw = 7 days
duration_spend = 2 years
duration_legal = 3 years
fee_withdraw = TESTKUDOS:0.05
fee_deposit = TESTKUDOS:0.02
fee_refresh = TESTKUDOS:0.03
fee_refund = TESTKUDOS:0.04
CIPHER = RSA
rsa_keysize = 1024
[coin_kudos_10]
value = TESTKUDOS:10
duration_withdraw = 7 days
duration_spend = 2 years
duration_legal = 3 years
fee_withdraw = TESTKUDOS:0.01
fee_deposit = TESTKUDOS:0.01
fee_refresh = TESTKUDOS:0.03
fee_refund = TESTKUDOS:0.01
CIPHER = RSA
rsa_keysize = 1024
[benchmark]
BANK_DETAILS = bank_details.json
MERCHANT_DETAILS = merchant_details.json
[arm]
CONFIG = /research/taler/exchange/src/auditor/auditor-basedb.conf
[taler]
CURRENCY_ROUND_UNIT = TESTKUDOS:0.01
CURRENCY = TESTKUDOS
[merchantdb-postgres]
CONFIG = postgres:///auditor-basedb
[merchant]
WIREFORMAT = default
DEFAULT_MAX_DEPOSIT_FEE = TESTKUDOS:0.1
KEYFILE = ${TALER_DATA_HOME}/merchant/merchant.priv
DEFAULT_MAX_WIRE_FEE = TESTKUDOS:0.10
WIRE_TRANSFER_DELAY = 1 minute
FORCE_AUDIT = YES
UNIXPATH = ${TALER_RUNTIME_DIR}/merchant.http
[exchangedb-postgres]
CONFIG = postgres:///auditor-basedb
[exchange]
MASTER_PUBLIC_KEY = RKNMPRGXCX35H11WEYXDXYHPR7NX2QK9BG15MT0QEF75PC5KR470
SIGNKEY_DURATION = 4 weeks
LOOKAHEAD_SIGN = 32 weeks 1 day
SIGNKEY_LEGAL_DURATION = 4 weeks
UNIXPATH = ${TALER_RUNTIME_DIR}/exchange.http
[bank]
HTTP_PORT = 8082
SUGGESTED_EXCHANGE = http://localhost:8081/
SUGGESTED_EXCHANGE_PAYTO = payto://x-taler-bank/localhost/2
ALLOW_REGISTRATIONS = YES
SERVE = http
MAX_DEBT_BANK = TESTKUDOS:100000.0
MAX_DEBT = TESTKUDOS:50.0
DATABASE = postgres:///auditor-basedb
[auditordb-postgres]
CONFIG = postgres:///auditor-basedb
[auditor]
BASE_URL = http://localhost:8083/
TINY_AMOUNT = TESTKUDOS:0.01
PUBLIC_KEY = 0EHPW5WEKHXPPN4MPJNGA7Z6D29JP21GKVNV8ARFB1YW7WWJX20G
[PATHS]
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,75 +1,12 @@
[exchange]
MAX_KEYS_CACHING = forever
DB = postgres
SERVE = tcp
UNIXPATH = ${TALER_RUNTIME_DIR}/exchange.http
UNIXPATH_MODE = 660
PORT = 8081
BASE_URL = http://localhost:8081/
SIGNKEY_DURATION = 4 weeks
SIGNKEY_LEGAL_DURATION = 4 weeks
LOOKAHEAD_SIGN = 32 weeks 1 day
[merchant]
SERVE = tcp
PORT = 9966
UNIXPATH = ${TALER_RUNTIME_DIR}/merchant.http
UNIXPATH_MODE = 660
DEFAULT_WIRE_FEE_AMORTIZATION = 1
DB = postgres
WIREFORMAT = default
# Set very low, so we can be sure that the database generated
# will contain wire transfers "ready" for the aggregator.
WIRE_TRANSFER_DELAY = 1 minute
DEFAULT_PAY_DEADLINE = 1 day
DEFAULT_MAX_DEPOSIT_FEE = TESTKUDOS:0.1
KEYFILE = ${TALER_DATA_HOME}/merchant/merchant.priv
DEFAULT_MAX_WIRE_FEE = TESTKUDOS:0.10
# Ensure that merchant reports EVERY deposit confirmation to auditor
FORCE_AUDIT = YES
[exchange-offline]
MASTER_PRIV_FILE = auditor-basedb.mpriv
[instance-default]
KEYFILE = ${TALER_DATA_HOME}/merchant/default.priv
NAME = Merchant Inc.
[auditor]
DB = postgres
AUDITOR_PRIV_FILE = ${TALER_DATA_HOME}/auditor/offline-keys/auditor.priv
SERVE = tcp
UNIXPATH = ${TALER_RUNTIME_DIR}/exchange.http
UNIXPATH_MODE = 660
PORT = 8083
BASE_URL = http://localhost:8083/
TINY_AMOUNT = TESTKUDOS:0.01
[PATHS]
TALER_HOME = ${PWD}/generate_auditordb_home/
TALER_DATA_HOME = $TALER_HOME/.local/share/taler/
TALER_CONFIG_HOME = $TALER_HOME/.config/taler/
TALER_CACHE_HOME = $TALER_HOME/.cache/taler/
TALER_RUNTIME_DIR = ${TMPDIR:-${TMP:-/tmp}}/taler-system-runtime/
[bank]
DATABASE = postgres:///taler-auditor-basedb
MAX_DEBT = TESTKUDOS:50.0
MAX_DEBT_BANK = TESTKUDOS:100000.0
HTTP_PORT = 8082
SUGGESTED_EXCHANGE = http://localhost:8081/
SUGGESTED_EXCHANGE_PAYTO = payto://x-taler-bank/localhost/2
ALLOW_REGISTRATIONS = YES
SERVE = http
[exchangedb]
IDLE_RESERVE_EXPIRATION_TIME = 4 weeks
LEGAL_RESERVE_EXPIRATION_TIME = 7 years
[taler]
CURRENCY = TESTKUDOS
CURRENCY_ROUND_UNIT = TESTKUDOS:0.01
[exchange-account-1]
PAYTO_URI = payto://x-taler-bank/localhost/Exchange
PAYTO_URI = payto://iban/SANDBOXX/DE989651?receiver-name=Exchange+Company
enable_debit = yes
enable_credit = yes
@ -85,6 +22,7 @@ HONOR_default = YES
ACTIVE_default = YES
[merchant-exchange-default]
MASTER_KEY = RKNMPRGXCX35H11WEYXDXYHPR7NX2QK9BG15MT0QEF75PC5KR470
EXCHANGE_BASE_URL = http://localhost:8081/
CURRENCY = TESTKUDOS
@ -193,30 +131,59 @@ fee_refund = TESTKUDOS:0.01
CIPHER = RSA
rsa_keysize = 1024
[coin_kudos_ct_1]
value = TESTKUDOS:0.01
duration_withdraw = 7 days
duration_spend = 2 years
duration_legal = 3 years
fee_withdraw = TESTKUDOS:0.01
fee_deposit = TESTKUDOS:0.01
fee_refresh = TESTKUDOS:0.01
fee_refund = TESTKUDOS:0.01
CIPHER = RSA
rsa_keysize = 1024
[coin_kudos_ct_10]
value = TESTKUDOS:0.10
duration_withdraw = 7 days
duration_spend = 2 years
duration_legal = 3 years
fee_withdraw = TESTKUDOS:0.01
fee_deposit = TESTKUDOS:0.01
fee_refresh = TESTKUDOS:0.03
fee_refund = TESTKUDOS:0.01
CIPHER = RSA
rsa_keysize = 1024
[benchmark]
BANK_DETAILS = bank_details.json
MERCHANT_DETAILS = merchant_details.json
[arm]
CONFIG = /research/taler/exchange/src/auditor/auditor-basedb.conf
[taler]
CURRENCY_ROUND_UNIT = TESTKUDOS:0.01
CURRENCY = TESTKUDOS
[merchantdb-postgres]
CONFIG = postgres:///auditor-basedb
[merchant]
WIREFORMAT = default
DEFAULT_MAX_DEPOSIT_FEE = TESTKUDOS:0.1
KEYFILE = ${TALER_DATA_HOME}/merchant/merchant.priv
DEFAULT_MAX_WIRE_FEE = TESTKUDOS:0.10
WIRE_TRANSFER_DELAY = 1 minute
FORCE_AUDIT = YES
UNIXPATH = ${TALER_RUNTIME_DIR}/merchant.http
[exchangedb-postgres]
CONFIG = postgres:///auditor-basedb
[exchange]
MASTER_PUBLIC_KEY = RKNMPRGXCX35H11WEYXDXYHPR7NX2QK9BG15MT0QEF75PC5KR470
SIGNKEY_DURATION = 4 weeks
LOOKAHEAD_SIGN = 32 weeks 1 day
SIGNKEY_LEGAL_DURATION = 4 weeks
UNIXPATH = ${TALER_RUNTIME_DIR}/exchange.http
[bank]
HTTP_PORT = 8082
SUGGESTED_EXCHANGE = http://localhost:8081/
SUGGESTED_EXCHANGE_PAYTO = payto://x-taler-bank/localhost/2
ALLOW_REGISTRATIONS = YES
SERVE = http
MAX_DEBT_BANK = TESTKUDOS:100000.0
MAX_DEBT = TESTKUDOS:50.0
DATABASE = postgres:///auditor-basedb
[auditordb-postgres]
CONFIG = postgres:///auditor-basedb
[auditor]
BASE_URL = http://localhost:8083/
TINY_AMOUNT = TESTKUDOS:0.01
PUBLIC_KEY = 0EHPW5WEKHXPPN4MPJNGA7Z6D29JP21GKVNV8ARFB1YW7WWJX20G
[PATHS]
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

@ -3,8 +3,8 @@
# testing from a 'correct' interaction between exchange,
# wallet and merchant.
#
# Creates $BASEDB.sql, $BASEDB.fees, $BASEDB.mpub and
# $BASEDB.age.
# Creates $BASEDB.sql, $BASEDB.fees,
# $BASEDB.{mpub,mpriv}.
# Default $BASEDB is "auditor-basedb", override via $1.
#
# Currently must be run online as it interacts with
@ -68,10 +68,8 @@ rm -f $TARGET_DB
# Configuration file will be edited, so we create one
# from the template.
CONF_ONCE=${BASEDB}.conf
CONF_ONCE=$1.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"
@ -86,17 +84,15 @@ echo " FOUND"
# Clean up
DATA_DIR=`taler-config -f -c $CONF_ONCE -s PATHS -o TALER_HOME`
rm -rf $DATA_DIR || true
# reset database
dropdb $TARGET_DB >/dev/null 2>/dev/null || true
createdb $TARGET_DB || exit_skip "Could not create database $TARGET_DB"
# obtain key configuration data
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_FILE=$1.mpriv
MASTER_PRIV_DIR=`dirname $MASTER_PRIV_FILE`
taler-config -f -c ${CONF_ONCE} -s exchange-offline -o MASTER_PRIV_FILE -V ${MASTER_PRIV_FILE}
rm -f "${MASTER_PRIV_FILE}"
mkdir -p $MASTER_PRIV_DIR
gnunet-ecc -g1 $MASTER_PRIV_FILE > /dev/null
@ -104,8 +100,9 @@ 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}/
AUDITOR_URL=http://localhost:8083/
AUDITOR_PRIV_FILE=`taler-config -f -c $CONF_ONCE -s AUDITOR -o AUDITOR_PRIV_FILE`
AUDITOR_PRIV_FILE=$1.apriv
AUDITOR_PRIV_DIR=`dirname $AUDITOR_PRIV_FILE`
taler-config -f -c ${CONF_ONCE} -s auditor -o AUDITOR_PRIV_FILE -V ${AUDITOR_PRIV_FILE}
mkdir -p $AUDITOR_PRIV_DIR
gnunet-ecc -g1 $AUDITOR_PRIV_FILE > /dev/null
AUDITOR_PUB=`gnunet-ecc -p $AUDITOR_PRIV_FILE`
@ -120,6 +117,7 @@ echo "AUDITOR PUB is ${AUDITOR_PUB} using file ${AUDITOR_PRIV_FILE}"
taler-config -c $CONF_ONCE -s exchange -o MASTER_PUBLIC_KEY -V $MASTER_PUB
taler-config -c $CONF_ONCE -s auditor -o PUBLIC_KEY -V $AUDITOR_PUB
taler-config -c $CONF_ONCE -s merchant-exchange-default -o MASTER_KEY -V $MASTER_PUB
taler-config -c $CONF_ONCE -s exchangedb-postgres -o CONFIG -V postgres:///$TARGET_DB
taler-config -c $CONF_ONCE -s auditordb-postgres -o CONFIG -V postgres:///$TARGET_DB
taler-config -c $CONF_ONCE -s merchantdb-postgres -o CONFIG -V postgres:///$TARGET_DB
@ -232,7 +230,6 @@ echo " DONE"
# run wallet CLI
echo "Running wallet"
taler-wallet-cli --no-throttle --wallet-db=$WALLET_DB api 'runIntegrationTest' \
"$(jq -n '
{
@ -257,13 +254,10 @@ sqlite3 $TARGET_DB ".dump" > ${BASEDB}-libeufin.sql
echo $MASTER_PUB > ${BASEDB}.mpub
date +%s > ${BASEDB}.age
# clean up
echo "Final clean up"
dropdb $TARGET_DB
rm $TARGET_DB # libeufin DB
rm -rf $DATA_DIR || true
echo "====================================="
echo " Finished generation of $BASEDB"

View File

@ -18,17 +18,17 @@ PASSWORD = x
WIREFEE_BASE_DIR = ${PWD}/wirefees/
[auditordb-postgres]
CONFIG = postgres:///taler-auditor-test
CONFIG = postgres:///revoke-basedb
[exchangedb-postgres]
CONFIG = postgres:///taler-auditor-test
CONFIG = postgres:///revoke-basedb
[taler]
CURRENCY = TESTKUDOS
CURRENCY_ROUND_UNIT = TESTKUDOS:0.01
[bank]
DATABASE = postgres:///taler-auditor-test
DATABASE = postgres:///revoke-basedb
MAX_DEBT = TESTKUDOS:50.0
MAX_DEBT_BANK = TESTKUDOS:100000.0
HTTP_PORT = 8082

View File

@ -255,10 +255,6 @@ function run_audit () {
done
echo "... DONE."
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 "
@ -280,8 +276,15 @@ 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
if test -z "${PAIN_UUID}"
then
echo -n "Payment likely already submitted, running submit-payments without UUID anyway ..."
libeufin-cli accounts submit-payments exchange-nexus
else
echo -n "Running submitting payment ${PAIN_UUID} ..."
libeufin-cli accounts submit-payments --payment-uuid ${PAIN_UUID} exchange-nexus
fi
echo " DONE"
fi
audit_only
post_audit
@ -1959,13 +1962,16 @@ function test_33() {
# Run all the tests against the database given in $1.
# Sets $fail to 0 on success, non-zero on failure.
check_with_database()
function check_with_database()
{
BASEDB=$1
CONF=$1.conf
echo "Running test suite with database $BASEDB using configuration $CONF"
MASTER_PRIV_FILE=${BASEDB}.mpriv
taler-config -f -c ${CONF} -s exchange-offline -o MASTER_PRIV_FILE -V ${MASTER_PRIV_FILE}
MASTER_PUB=`gnunet-ecc -p $MASTER_PRIV_FILE`
# Setup database-specific globals
MASTER_PUB=`cat ${BASEDB}.mpub`
echo "MASTER PUB is ${MASTER_PUB} using file ${MASTER_PRIV_FILE}"
# Load database
full_reload
@ -1995,9 +2001,6 @@ check_with_database()
# Postgres database to use
DB=auditor-basedb
# Configuration file to use
CONF=${DB}.conf
# test required commands exist
echo "Testing for jq"
jq -h > /dev/null || exit_skip "jq required"
@ -2041,9 +2044,9 @@ EXPORT PGHOST="@POSTGRES_SOCKET"
echo "Generating fresh database at $MYDIR"
if faketime -f '-1 d' ./generate-auditor-basedb.sh $MYDIR/basedb
if faketime -f '-1 d' ./generate-auditor-basedb.sh $MYDIR/auditor-basedb
then
check_with_database $MYDIR/basedb
check_with_database $MYDIR/auditor-basedb
if test x$fail != x0
then
exit $fail

View File

@ -552,10 +552,15 @@ function test_4() {
function check_with_database()
{
BASEDB=$1
# Configuration file to use
CONF=$1.conf
echo "Running test suite with database $BASEDB using configuration $CONF"
# Setup database-specific globals
MASTER_PUB=`cat ${BASEDB}.mpub`
MASTER_PRIV_FILE=${BASEDB}.mpriv
taler-config -f -c ${CONF} -s exchange-offline -o MASTER_PRIV_FILE -V ${MASTER_PRIV_FILE}
MASTER_PUB=`gnunet-ecc -p $MASTER_PRIV_FILE`
echo "MASTER PUB is ${MASTER_PUB} using file ${MASTER_PRIV_FILE}"
# Load database
full_reload
@ -582,9 +587,6 @@ function check_with_database()
# Postgres database to use (must match revoke-basedb.conf)
DB=taler-auditor-test
# Configuration file to use
CONF=revoke-basedb.conf
# test required commands exist
echo "Testing for jq"
jq -h > /dev/null || exit_skip "jq required"
@ -626,9 +628,9 @@ EXPORT PGHOST="@POSTGRES_SOCKET"
MYDIR=`mktemp -d /tmp/taler-auditor-basedbXXXXXX`
echo "Generating fresh database at $MYDIR"
if faketime -f '-1 d' ./generate-revoke-basedb.sh $MYDIR/basedb
if faketime -f '-1 d' ./generate-revoke-basedb.sh $MYDIR/revoke-basedb
then
check_with_database $MYDIR/basedb
check_with_database $MYDIR/revoke-basedb
if test x$fail != x0
then
exit $fail