diff options
author | Christian Grothoff <christian@grothoff.org> | 2019-10-09 14:23:37 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2019-10-09 14:23:37 +0200 |
commit | d40f01b634ac567cd24f34453a9083947cb83a4d (patch) | |
tree | 59ed59268643dd23ef45aee6f95b189ed0f6295c /src | |
parent | 4e54a41fe3478572f1702cc7085b54d62438716e (diff) | |
download | exchange-d40f01b634ac567cd24f34453a9083947cb83a4d.tar.xz |
expand test to cover withdrawing expired denominations, fix auditor-report template
Diffstat (limited to 'src')
-rw-r--r-- | src/auditor/taler-auditor.c | 1 | ||||
-rwxr-xr-x | src/auditor/test-auditor.sh | 47 |
2 files changed, 46 insertions, 2 deletions
diff --git a/src/auditor/taler-auditor.c b/src/auditor/taler-auditor.c index 296af8222..398c0b04b 100644 --- a/src/auditor/taler-auditor.c +++ b/src/auditor/taler-auditor.c @@ -5487,6 +5487,7 @@ run (void *cls, /* Tested in test-auditor.sh #14/#15 */ "row_inconsistencies", report_row_inconsistencies, + /* Tested in test-auditor.sh #23 */ "denomination_key_validity_withdraw_inconsistencies", denomination_key_validity_withdraw_inconsistencies, "coin_inconsistencies", diff --git a/src/auditor/test-auditor.sh b/src/auditor/test-auditor.sh index 7e9f826dd..83dcdcd93 100755 --- a/src/auditor/test-auditor.sh +++ b/src/auditor/test-auditor.sh @@ -59,7 +59,7 @@ function pre_audit () { if test ${1:-no} = "aggregator" then echo -n "Running exchange aggregator ..." - taler-exchange-aggregator -L INFO -t -c $CONF 2> aggregator.log + taler-exchange-aggregator -L INFO -t -c $CONF 2> aggregator.log || exit_fail "FAIL" echo " DONE" fi } @@ -84,7 +84,18 @@ function audit_only () { # Cleanup to run after the auditor function post_audit () { kill -TERM `jobs -p` >/dev/null 2>/dev/null || true - sleep 1 + echo -n "Waiting for servers to die ..." + for n in `seq 1 20` + do + echo -n "." + sleep 0.1 + OK=0 + # bank + wget --timeout=0.1 http://localhost:8082/ -o /dev/null -O /dev/null >/dev/null && continue + OK=1 + break + done + echo "DONE" echo -n "TeXing ." ../../contrib/render.py test-audit.json test-wire-audit.json < ../../contrib/auditor-report.tex.j2 > test-report.tex || exit_fail "Renderer failed" @@ -135,6 +146,7 @@ jq -e .wire_out_amount_inconsistencies[0] < test-wire-audit.json > /dev/null && jq -e .reserve_in_amount_inconsistencies[0] < test-wire-audit.json > /dev/null && exit_fail "Unexpected reserve in inconsistency detected in ordinary run" jq -e .missattribution_inconsistencies[0] < test-wire-audit.json > /dev/null && exit_fail "Unexpected missattribution inconsistency detected in ordinary run" jq -e .row_inconsistencies[0] < test-wire-audit.json > /dev/null && exit_fail "Unexpected row inconsistency detected in ordinary run" +jq -e .denomination_key_validity_withdraw_inconsistencies[0] < test-audit.json > /dev/null && exit_fail "Unexpected denomination key withdraw inconsistency detected in ordinary run" jq -e .row_minor_inconsistencies[0] < test-wire-audit.json > /dev/null && exit_fail "Unexpected minor row inconsistency detected in ordinary run" jq -e .lag_details[0] < test-wire-audit.json > /dev/null && exit_fail "Unexpected lag detected in ordinary run" jq -e .wire_format_inconsistencies[0] < test-wire-audit.json > /dev/null && exit_fail "Unexpected wire format inconsistencies detected in ordinary run" @@ -1218,6 +1230,8 @@ fi # Undo echo "UPDATE reserves_in SET execution_date='${OLD_TIME}',credit_val=${OLD_VAL} WHERE reserve_in_serial_id=1;" | psql -Aqt $DB +echo "UPDATE reserves SET current_balance_val=current_balance_val-100 WHERE reserve_pub='${RES_PUB}';" | psql -Aqt $DB + } @@ -1282,6 +1296,35 @@ fi + +# Test use of withdraw-expired denomination key +function test_23() { +echo "===========23: denomination key expired =================" + +H_DENOM=`echo 'SELECT denom_pub_hash FROM reserves_out LIMIT 1;' | psql $DB -Aqt` + +OLD_START=`echo "SELECT valid_from FROM auditor_denominations WHERE denom_pub_hash='${H_DENOM}';" | psql $DB -Aqt` +OLD_WEXP=`echo "SELECT expire_withdraw FROM auditor_denominations WHERE denom_pub_hash='${H_DENOM}';" | psql $DB -Aqt` +# Basically expires 'immediately', so that the withdraw must have been 'invalid' +NEW_WEXP=`expr $OLD_START + 1` + +echo "UPDATE auditor_denominations SET expire_withdraw=${NEW_WEXP} WHERE denom_pub_hash='${H_DENOM}';" | psql -Aqt $DB + + +run_audit + +echo -n "Testing inconsistency detection... " +# FIXME +jq -e .denomination_key_validity_withdraw_inconsistencies[0] < test-audit.json > /dev/null || exit_fail "Denomination key withdraw inconsistency not detected" + +echo PASS + +# Undo modification +echo "UPDATE auditor_denominations SET expire_withdraw=${OLD_WEXP} WHERE denom_pub_hash='${H_DENOM}';" | psql -Aqt $DB + +} + + # ************************************************** # FIXME: Add more tests here! :-) # Specifically: |