aboutsummaryrefslogtreecommitdiff
path: root/src/auditor/test-auditor.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/auditor/test-auditor.sh')
-rwxr-xr-xsrc/auditor/test-auditor.sh47
1 files changed, 45 insertions, 2 deletions
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 () {
59 if test ${1:-no} = "aggregator" 59 if test ${1:-no} = "aggregator"
60 then 60 then
61 echo -n "Running exchange aggregator ..." 61 echo -n "Running exchange aggregator ..."
62 taler-exchange-aggregator -L INFO -t -c $CONF 2> aggregator.log 62 taler-exchange-aggregator -L INFO -t -c $CONF 2> aggregator.log || exit_fail "FAIL"
63 echo " DONE" 63 echo " DONE"
64 fi 64 fi
65} 65}
@@ -84,7 +84,18 @@ function audit_only () {
84# Cleanup to run after the auditor 84# Cleanup to run after the auditor
85function post_audit () { 85function post_audit () {
86 kill -TERM `jobs -p` >/dev/null 2>/dev/null || true 86 kill -TERM `jobs -p` >/dev/null 2>/dev/null || true
87 sleep 1 87 echo -n "Waiting for servers to die ..."
88 for n in `seq 1 20`
89 do
90 echo -n "."
91 sleep 0.1
92 OK=0
93 # bank
94 wget --timeout=0.1 http://localhost:8082/ -o /dev/null -O /dev/null >/dev/null && continue
95 OK=1
96 break
97 done
98 echo "DONE"
88 echo -n "TeXing ." 99 echo -n "TeXing ."
89 ../../contrib/render.py test-audit.json test-wire-audit.json < ../../contrib/auditor-report.tex.j2 > test-report.tex || exit_fail "Renderer failed" 100 ../../contrib/render.py test-audit.json test-wire-audit.json < ../../contrib/auditor-report.tex.j2 > test-report.tex || exit_fail "Renderer failed"
90 101
@@ -135,6 +146,7 @@ jq -e .wire_out_amount_inconsistencies[0] < test-wire-audit.json > /dev/null &&
135jq -e .reserve_in_amount_inconsistencies[0] < test-wire-audit.json > /dev/null && exit_fail "Unexpected reserve in inconsistency detected in ordinary run" 146jq -e .reserve_in_amount_inconsistencies[0] < test-wire-audit.json > /dev/null && exit_fail "Unexpected reserve in inconsistency detected in ordinary run"
136jq -e .missattribution_inconsistencies[0] < test-wire-audit.json > /dev/null && exit_fail "Unexpected missattribution inconsistency detected in ordinary run" 147jq -e .missattribution_inconsistencies[0] < test-wire-audit.json > /dev/null && exit_fail "Unexpected missattribution inconsistency detected in ordinary run"
137jq -e .row_inconsistencies[0] < test-wire-audit.json > /dev/null && exit_fail "Unexpected row inconsistency detected in ordinary run" 148jq -e .row_inconsistencies[0] < test-wire-audit.json > /dev/null && exit_fail "Unexpected row inconsistency detected in ordinary run"
149jq -e .denomination_key_validity_withdraw_inconsistencies[0] < test-audit.json > /dev/null && exit_fail "Unexpected denomination key withdraw inconsistency detected in ordinary run"
138jq -e .row_minor_inconsistencies[0] < test-wire-audit.json > /dev/null && exit_fail "Unexpected minor row inconsistency detected in ordinary run" 150jq -e .row_minor_inconsistencies[0] < test-wire-audit.json > /dev/null && exit_fail "Unexpected minor row inconsistency detected in ordinary run"
139jq -e .lag_details[0] < test-wire-audit.json > /dev/null && exit_fail "Unexpected lag detected in ordinary run" 151jq -e .lag_details[0] < test-wire-audit.json > /dev/null && exit_fail "Unexpected lag detected in ordinary run"
140jq -e .wire_format_inconsistencies[0] < test-wire-audit.json > /dev/null && exit_fail "Unexpected wire format inconsistencies detected in ordinary run" 152jq -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
1218 1230
1219# Undo 1231# Undo
1220echo "UPDATE reserves_in SET execution_date='${OLD_TIME}',credit_val=${OLD_VAL} WHERE reserve_in_serial_id=1;" | psql -Aqt $DB 1232echo "UPDATE reserves_in SET execution_date='${OLD_TIME}',credit_val=${OLD_VAL} WHERE reserve_in_serial_id=1;" | psql -Aqt $DB
1233echo "UPDATE reserves SET current_balance_val=current_balance_val-100 WHERE reserve_pub='${RES_PUB}';" | psql -Aqt $DB
1234
1221} 1235}
1222 1236
1223 1237
@@ -1282,6 +1296,35 @@ fi
1282 1296
1283 1297
1284 1298
1299
1300# Test use of withdraw-expired denomination key
1301function test_23() {
1302echo "===========23: denomination key expired ================="
1303
1304H_DENOM=`echo 'SELECT denom_pub_hash FROM reserves_out LIMIT 1;' | psql $DB -Aqt`
1305
1306OLD_START=`echo "SELECT valid_from FROM auditor_denominations WHERE denom_pub_hash='${H_DENOM}';" | psql $DB -Aqt`
1307OLD_WEXP=`echo "SELECT expire_withdraw FROM auditor_denominations WHERE denom_pub_hash='${H_DENOM}';" | psql $DB -Aqt`
1308# Basically expires 'immediately', so that the withdraw must have been 'invalid'
1309NEW_WEXP=`expr $OLD_START + 1`
1310
1311echo "UPDATE auditor_denominations SET expire_withdraw=${NEW_WEXP} WHERE denom_pub_hash='${H_DENOM}';" | psql -Aqt $DB
1312
1313
1314run_audit
1315
1316echo -n "Testing inconsistency detection... "
1317# FIXME
1318jq -e .denomination_key_validity_withdraw_inconsistencies[0] < test-audit.json > /dev/null || exit_fail "Denomination key withdraw inconsistency not detected"
1319
1320echo PASS
1321
1322# Undo modification
1323echo "UPDATE auditor_denominations SET expire_withdraw=${OLD_WEXP} WHERE denom_pub_hash='${H_DENOM}';" | psql -Aqt $DB
1324
1325}
1326
1327
1285# ************************************************** 1328# **************************************************
1286# FIXME: Add more tests here! :-) 1329# FIXME: Add more tests here! :-)
1287# Specifically: 1330# Specifically: