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.sh48
1 files changed, 47 insertions, 1 deletions
diff --git a/src/auditor/test-auditor.sh b/src/auditor/test-auditor.sh
index 2020ce64a..aeb67426d 100755
--- a/src/auditor/test-auditor.sh
+++ b/src/auditor/test-auditor.sh
@@ -9,7 +9,7 @@ set -eu
9 9
10# Set of numbers for all the testcases. 10# Set of numbers for all the testcases.
11# When adding new tests, increase the last number: 11# When adding new tests, increase the last number:
12ALL_TESTS=`seq 0 24` 12ALL_TESTS=`seq 0 25`
13 13
14# $TESTS determines which tests we should run. 14# $TESTS determines which tests we should run.
15# This construction is used to make it easy to 15# This construction is used to make it easy to
@@ -138,6 +138,7 @@ echo "Checking output"
138# if an emergency was detected, that is a bug and we should fail 138# if an emergency was detected, that is a bug and we should fail
139echo -n "Test for emergencies... " 139echo -n "Test for emergencies... "
140jq -e .emergencies[0] < test-audit.json > /dev/null && exit_fail "Unexpected emergency detected in ordinary run" || echo PASS 140jq -e .emergencies[0] < test-audit.json > /dev/null && exit_fail "Unexpected emergency detected in ordinary run" || echo PASS
141jq -e .deposit_confirmation_inconsistencies[0] < test-audit.json > /dev/null && exit_fail "Unexpected deposit confirmation inconsistency detected" || echo PASS
141echo -n "Test for emergencies by count... " 142echo -n "Test for emergencies by count... "
142jq -e .emergencies_by_count[0] < test-audit.json > /dev/null && exit_fail "Unexpected emergency by count detected in ordinary run" || echo PASS 143jq -e .emergencies_by_count[0] < test-audit.json > /dev/null && exit_fail "Unexpected emergency by count detected in ordinary run" || echo PASS
143 144
@@ -1406,6 +1407,48 @@ fi
1406} 1407}
1407 1408
1408 1409
1410
1411# Test for missing deposits in exchange database.
1412function test_25() {
1413
1414echo "===========25: deposits missing ==========="
1415# Modify denom_sig, so it is wrong
1416echo "DELETE FROM deposits;" | psql -Aqt $DB
1417echo "DELETE FROM deposits WHERE deposit_serial_id=1;" | psql -Aqt $DB
1418
1419run_audit
1420
1421echo -n "Testing inconsistency detection... "
1422
1423jq -e .deposit_confirmation_inconsistencies[0] < test-audit.json > /dev/null || exit_fail "Deposit confirmation inconsistency NOT detected"
1424
1425#OP=`jq -er .bad_sig_losses[0].operation < test-audit.json`
1426#if test x$OP != xmelt
1427#then
1428# exit_fail "Operation wrong, got $OP"
1429#fi
1430
1431#LOSS=`jq -er .bad_sig_losses[0].loss < test-audit.json`
1432#TOTAL_LOSS=`jq -er .total_bad_sig_loss < test-audit.json`
1433#if test x$LOSS != x$TOTAL_LOSS
1434#then
1435# exit_fail "Loss inconsistent, got $LOSS and $TOTAL_LOSS"
1436#fi
1437#if test x$TOTAL_LOSS = TESTKUDOS:0
1438#then
1439# exit_fail "Loss zero"
1440#fi
1441
1442echo PASS
1443
1444# cannot easily undo DELETE, hence full reload
1445echo -n "Reloading database ..."
1446full_reload
1447echo "DONE"
1448}
1449
1450
1451
1409# ************************************************** 1452# **************************************************
1410# FIXME: Add more tests here! :-) 1453# FIXME: Add more tests here! :-)
1411# Specifically: 1454# Specifically:
@@ -1463,6 +1506,9 @@ check_with_database()
1463 1506
1464 1507
1465 1508
1509
1510
1511
1466# *************** Main logic starts here ************** 1512# *************** Main logic starts here **************
1467 1513
1468# ####### Setup globals ###### 1514# ####### Setup globals ######