aboutsummaryrefslogtreecommitdiff
path: root/src/auditor
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2024-03-23 14:01:04 +0100
committerChristian Grothoff <christian@grothoff.org>2024-03-23 14:01:04 +0100
commit78e568ea0cd3b1e9cf26852ed3a80e0283a7cc1f (patch)
tree0565c839b59cc55f879ccea8c9e34d907687aefc /src/auditor
parent921d4efd4c94e6398a142c6910a7da4c770480ba (diff)
fix configuration files of test-auditor
Diffstat (limited to 'src/auditor')
-rw-r--r--src/auditor/generate-auditor-basedb.conf17
-rwxr-xr-xsrc/auditor/generate-auditor-basedb.sh20
-rwxr-xr-xsrc/auditor/generate-revoke-basedb.sh6
-rwxr-xr-xsrc/auditor/setup.sh4
-rwxr-xr-xsrc/auditor/test-auditor.sh24
5 files changed, 50 insertions, 21 deletions
diff --git a/src/auditor/generate-auditor-basedb.conf b/src/auditor/generate-auditor-basedb.conf
index bcdc31860..233cfbe7c 100644
--- a/src/auditor/generate-auditor-basedb.conf
+++ b/src/auditor/generate-auditor-basedb.conf
@@ -24,6 +24,21 @@ LEGAL_RESERVE_EXPIRATION_TIME = 4 weeks
AGGREGATOR_SHIFT = 1 s
DEFAULT_PURSE_LIMIT = 1
+[libeufin-bank]
+CURRENCY = TESTKUDOS
+DEFAULT_CUSTOMER_DEBT_LIMIT = TESTKUDOS:200
+DEFAULT_ADMIN_DEBT_LIMIT = TESTKUDOS:2000
+REGISTRATION_BONUS_ENABLED = yes
+REGISTRATION_BONUS = TESTKUDOS:100
+SUGGESTED_WITHDRAWAL_EXCHANGE = http://localhost:8081/
+WIRE_TYPE = iban
+IBAN_PAYTO_BIC = SANDBOXX
+SERVE = tcp
+PORT = 8082
+
+[libeufin-bankdb-postgres]
+CONFIG = postgresql:///auditor-basedb
+
[exchangedb-postgres]
CONFIG = postgres:///auditor-basedb
SQL_DIR = $DATADIR/sql/exchange/
@@ -91,7 +106,7 @@ REGISTRATION_BONUS_ENABLED = yes
REGISTRATION_BONUS = TESTKUDOS:100
SUGGESTED_WITHDRAWAL_EXCHANGE = http://localhost:8081/
SERVE = tcp
-PORT = 8082
+PORT = 8082
[auditor]
BASE_URL = http://localhost:8083/
diff --git a/src/auditor/generate-auditor-basedb.sh b/src/auditor/generate-auditor-basedb.sh
index f2531223d..0ca96be4f 100755
--- a/src/auditor/generate-auditor-basedb.sh
+++ b/src/auditor/generate-auditor-basedb.sh
@@ -47,7 +47,6 @@ echo -n "Testing for curl ..."
curl --help >/dev/null </dev/null || exit_skip " MISSING"
echo " FOUND"
-
# reset database
echo -n "Reset 'auditor-basedb' database at $PGHOST ..."
dropdb "auditor-basedb" >/dev/null 2>/dev/null || true
@@ -64,10 +63,21 @@ EXCHANGE_URL=$(taler-config -c "$CONF" -s EXCHANGE -o BASE_URL)
MERCHANT_PORT=$(taler-config -c "$CONF" -s MERCHANT -o PORT)
MERCHANT_URL="http://localhost:${MERCHANT_PORT}/"
BANK_PORT=$(taler-config -c "$CONF" -s BANK -o HTTP_PORT)
-BANK_URL="http://localhost:1${BANK_PORT}"
-
+BANK_URL="http://localhost:${BANK_PORT}"
+
+echo -n "Checking setup worked ..."
+wget \
+ --tries=1 \
+ --timeout=1 \
+ "${EXCHANGE_URL}config" \
+ -o /dev/null \
+ -O /dev/null >/dev/null
+echo "DONE"
+
+export MERCHANT_URL
echo -n "Setting up merchant ..."
-curl -H "Content-Type: application/json" -X POST -d '{"auth":{"method":"external"},"accounts":[{"payto_uri":"payto://iban/SANDBOXX/DE474361?receiver-name=Merchant43"}],"id":"default","name":"default","address":{},"jurisdiction":{},"default_max_wire_fee":"TESTKUDOS:1", "default_max_deposit_fee":"TESTKUDOS:1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_us" : 3600000000},"default_pay_delay":{"d_us": 3600000000}}' "${MERCHANT_URL}management/instances"
+
+curl -H "Content-Type: application/json" -X POST -d '{"auth":{"method":"external"},"accounts":[{"payto_uri":"payto://iban/SANDBOXX/DE474361?receiver-name=Merchant43"}],"id":"default","name":"default","address":{},"jurisdiction":{},"default_max_wire_fee":"TESTKUDOS:1", "default_max_deposit_fee":"TESTKUDOS:1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_us" : 3600000000},"default_pay_delay":{"d_us": 3600000000},"use_stefan":false}' "${MERCHANT_URL}management/instances"
echo " DONE"
# delete existing wallet database
@@ -91,7 +101,7 @@ taler-wallet-cli \
}' \
--arg MERCHANT_URL "$MERCHANT_URL" \
--arg EXCHANGE_URL "$EXCHANGE_URL" \
- --arg BANK_URL "$BANK_URL/demobanks/default/access-api/"
+ --arg BANK_URL "$BANK_URL"
)" &> taler-wallet-cli.log
echo " DONE"
diff --git a/src/auditor/generate-revoke-basedb.sh b/src/auditor/generate-revoke-basedb.sh
index 49f504d14..29aa74b27 100755
--- a/src/auditor/generate-revoke-basedb.sh
+++ b/src/auditor/generate-revoke-basedb.sh
@@ -32,12 +32,12 @@ EXCHANGE_URL=$(taler-config -c "$CONF" -s EXCHANGE -o BASE_URL)
MERCHANT_PORT=$(taler-config -c "$CONF" -s MERCHANT -o PORT)
MERCHANT_URL="http://localhost:${MERCHANT_PORT}/"
BANK_PORT=$(taler-config -c "$CONF" -s BANK -o HTTP_PORT)
-BANK_URL="http://localhost:1${BANK_PORT}"
+BANK_URL="http://localhost:${BANK_PORT}"
# Setup merchant
echo -n "Setting up merchant ..."
-curl -H "Content-Type: application/json" -X POST -d '{"auth": {"method": "external"}, "accounts":[{"payto_uri":"payto://iban/SANDBOXX/DE474361?receiver-name=Merchant43"}],"id":"default","name":"default","address":{},"jurisdiction":{},"default_max_wire_fee":"TESTKUDOS:1", "default_max_deposit_fee":"TESTKUDOS:1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_us" : 3600000000},"default_pay_delay":{"d_us": 3600000000}}' "${MERCHANT_URL}management/instances"
+curl -H "Content-Type: application/json" -X POST -d '{"auth": {"method": "external"}, "accounts":[{"payto_uri":"payto://iban/SANDBOXX/DE474361?receiver-name=Merchant43"}],"id":"default","name":"default","address":{},"jurisdiction":{},"default_max_wire_fee":"TESTKUDOS:1", "default_max_deposit_fee":"TESTKUDOS:1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_us" : 3600000000},"default_pay_delay":{"d_us": 3600000000},"use_stefan":true}' "${MERCHANT_URL}management/instances"
echo " DONE"
@@ -58,7 +58,7 @@ taler-wallet-cli \
corebankApiBaseUrl: $BANK_URL,
exchangeBaseUrl: $EXCHANGE_URL,
}' \
- --arg BANK_URL "$BANK_URL/demobanks/default/access-api/" \
+ --arg BANK_URL "$BANK_URL" \
--arg EXCHANGE_URL "$EXCHANGE_URL"
)" &> taler-wallet-cli-withdraw.log
diff --git a/src/auditor/setup.sh b/src/auditor/setup.sh
index eb8a784ee..1ac8980ad 100755
--- a/src/auditor/setup.sh
+++ b/src/auditor/setup.sh
@@ -35,7 +35,9 @@ function setup()
exec 3<> "$FIFO_OUT" 4< "$FIFO_OUT"
rm -rf "$FIFO_DIR"
# We require '-W' for our termination logic to work.
- taler-unified-setup.sh -W "$@" >&3 &
+ taler-unified-setup.sh -W "$@" \
+ | tee taler-unified-setup.log \
+ >&3 &
SETUP_PID=$!
# Close FD3
exec 3>&-
diff --git a/src/auditor/test-auditor.sh b/src/auditor/test-auditor.sh
index 65e77b04d..4c8389b99 100755
--- a/src/auditor/test-auditor.sh
+++ b/src/auditor/test-auditor.sh
@@ -2228,7 +2228,9 @@ INITDB_BIN=$(command -v initdb) || true
if [[ -n "$INITDB_BIN" ]]; then
echo " FOUND (in path) at $INITDB_BIN"
else
- HAVE_INITDB=$(find /usr -name "initdb" | head -1 2> /dev/null | grep postgres) \
+ HAVE_INITDB=$(find /usr -name "initdb" 2> /dev/null \
+ | head -1 2> /dev/null \
+ | grep postgres) \
|| exit_skip " MISSING"
echo " FOUND at $(dirname "$HAVE_INITDB")"
INITDB_BIN=$(echo "$HAVE_INITDB" | grep bin/initdb | grep postgres | sort -n | tail -n1)
@@ -2244,37 +2246,37 @@ $INITDB_BIN \
--no-sync \
--auth=trust \
-D "${TMPDIR}" \
+ --set listen_addresses='' \
+ --set fsync=off \
+ --set max_wal_senders=0 \
+ --set synchronous_commit=off \
+ --set wal_level=minimal \
+ --set unix_socket_directories="${TMPDIR}/sockets" \
> "${MY_TMP_DIR}/postgres-dbinit.log" \
2> "${MY_TMP_DIR}/postgres-dbinit.err"
echo "DONE"
SOCKETDIR="${TMPDIR}/sockets"
mkdir "${SOCKETDIR}"
+
echo -n "Launching Postgres service"
-cat - >> "$TMPDIR/postgresql.conf" <<EOF
-unix_socket_directories='${TMPDIR}/sockets'
-fsync=off
-max_wal_senders=0
-synchronous_commit=off
-wal_level=minimal
-listen_addresses=''
-EOF
+# Unix domain socket is NOT yet supported by libeufin!
grep -v host \
< "$TMPDIR/pg_hba.conf" \
> "$TMPDIR/pg_hba.conf.new"
mv "$TMPDIR/pg_hba.conf.new" "$TMPDIR/pg_hba.conf"
"${POSTGRES_PATH}/pg_ctl" \
-D "$TMPDIR" \
- -l /dev/null \
+ -l "${MY_TMP_DIR}/postgres.log" \
start \
> "${MY_TMP_DIR}/postgres-start.log" \
2> "${MY_TMP_DIR}/postgres-start.err"
echo " DONE"
PGHOST="$TMPDIR/sockets"
export PGHOST
-
MYDIR="${MY_TMP_DIR}/basedb"
mkdir -p "${MYDIR}"
echo "Generating fresh database at $MYDIR"
+
if faketime -f '-1 d' ./generate-auditor-basedb.sh -d "$MYDIR/$DB"
then
echo -n "Reset 'auditor-basedb' database at $PGHOST ..."