From 78e568ea0cd3b1e9cf26852ed3a80e0283a7cc1f Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 23 Mar 2024 14:01:04 +0100 Subject: fix configuration files of test-auditor --- src/auditor/generate-auditor-basedb.conf | 17 ++++++++++++++++- src/auditor/generate-auditor-basedb.sh | 20 +++++++++++++++----- src/auditor/generate-revoke-basedb.sh | 6 +++--- src/auditor/setup.sh | 4 +++- src/auditor/test-auditor.sh | 24 +++++++++++++----------- src/testing/test_exchange_api.conf | 2 ++ 6 files changed, 52 insertions(+), 21 deletions(-) (limited to 'src') 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 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" < "$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 ..." diff --git a/src/testing/test_exchange_api.conf b/src/testing/test_exchange_api.conf index 45c1fa89a..c25f5091a 100644 --- a/src/testing/test_exchange_api.conf +++ b/src/testing/test_exchange_api.conf @@ -11,6 +11,8 @@ DEFAULT_ADMIN_DEBT_LIMIT = EUR:2000 REGISTRATION_BONUS_ENABLED = yes REGISTRATION_BONUS = EUR:100 SUGGESTED_WITHDRAWAL_EXCHANGE = http://localhost:8081/ +WIRE_TYPE = iban +IBAN_PAYTO_BIC = SANDBOXX SERVE = tcp PORT = 8082 -- cgit v1.2.3