summaryrefslogtreecommitdiff
path: root/src/auditor/test-auditor.sh
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-08-15 00:01:45 +0200
committerChristian Grothoff <christian@grothoff.org>2022-08-15 00:01:45 +0200
commit39640c33395744bfa3679ea6923b46ef6881e315 (patch)
tree08497479857f3b274db411088c52c1d78856c4c2 /src/auditor/test-auditor.sh
parenta8ec6818bb236e883da753ab7290a22c9f773fae (diff)
downloadexchange-39640c33395744bfa3679ea6923b46ef6881e315.tar.gz
exchange-39640c33395744bfa3679ea6923b46ef6881e315.tar.bz2
exchange-39640c33395744bfa3679ea6923b46ef6881e315.zip
towards testing #4960
Diffstat (limited to 'src/auditor/test-auditor.sh')
-rwxr-xr-xsrc/auditor/test-auditor.sh41
1 files changed, 35 insertions, 6 deletions
diff --git a/src/auditor/test-auditor.sh b/src/auditor/test-auditor.sh
index 879595e6b..9aa15b53c 100755
--- a/src/auditor/test-auditor.sh
+++ b/src/auditor/test-auditor.sh
@@ -10,7 +10,7 @@ set -eu
# Set of numbers for all the testcases.
# When adding new tests, increase the last number:
-ALL_TESTS=`seq 0 34`
+ALL_TESTS=`seq 0 33`
# $TESTS determines which tests we should run.
# This construction is used to make it easy to
@@ -211,11 +211,31 @@ function run_audit () {
if test ${2:-no} = "drain"
then
echo -n "Running taler-exchange-offline drain ..."
- taler-exchange-offline -L DEBUG -c $CONF \
- drain TESTKUDOS:0.1 exchange-account-1 payto://x-taler-bank/localhost/drain-target \
+ 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 &
+ EPID=$!
+ # Wait for all services to be available
+ for n in `seq 1 50`
+ do
+ echo -n "."
+ sleep 0.1
+ OK=0
+ # exchange
+ wget http://localhost:8081/seed -o /dev/null -O /dev/null >/dev/null || continue
+ OK=1
+ break
+ done
+ echo "... DONE."
+ # FIXME-MS: need to make sure here that the target IBAN exists!
+ taler-exchange-offline -L DEBUG -c "${CONF}.tmp" \
+ 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"
@@ -223,7 +243,10 @@ function run_audit () {
echo -n "Running taler-exchange-transfer ..."
taler-exchange-transfer -L INFO -t -c $CONF 2> drain-transfer.log || exit_fail "FAIL"
echo " DONE"
-
+ # FIXME-MS: transfer tool is happy here, but
+ # the wire transfer triggered here does NOT
+ # show up during the audit. Do we have to
+ # trigger some libeufin/sandbox job first?
fi
audit_only
post_audit
@@ -1908,7 +1931,7 @@ fi
function test_34() {
echo "===========34: normal run with aggregator and profit drain==========="
-run_audit aggregator
+run_audit aggregator drain
echo "Checking output"
# if an emergency was detected, that is a bug and we should fail
@@ -2011,6 +2034,12 @@ then
exit_fail "Wrong arithmetic delta from reserves, got unexpected minus of $LOSS"
fi
+DRAINED=`jq -r .total_drained < test-audit-wire.json`
+if test $DRAINED != "TESTKUDOS:0.1"
+then
+ exit_fail "Wrong amount drained, got unexpected drain of $DRAINED"
+fi
+
jq -e .amount_arithmetic_inconsistencies[0] < test-audit-aggregation.json > /dev/null && exit_fail "Unexpected arithmetic inconsistencies from aggregations detected in ordinary run"
jq -e .amount_arithmetic_inconsistencies[0] < test-audit-coins.json > /dev/null && exit_fail "Unexpected arithmetic inconsistencies from coins detected in ordinary run"
jq -e .amount_arithmetic_inconsistencies[0] < test-audit-reserves.json > /dev/null && exit_fail "Unexpected arithmetic inconsistencies from reserves detected in ordinary run"