diff options
Diffstat (limited to 'src/auditor/test-auditor.sh')
-rwxr-xr-x | src/auditor/test-auditor.sh | 48 |
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: |
12 | ALL_TESTS=`seq 0 24` | 12 | ALL_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 |
139 | echo -n "Test for emergencies... " | 139 | echo -n "Test for emergencies... " |
140 | jq -e .emergencies[0] < test-audit.json > /dev/null && exit_fail "Unexpected emergency detected in ordinary run" || echo PASS | 140 | jq -e .emergencies[0] < test-audit.json > /dev/null && exit_fail "Unexpected emergency detected in ordinary run" || echo PASS |
141 | jq -e .deposit_confirmation_inconsistencies[0] < test-audit.json > /dev/null && exit_fail "Unexpected deposit confirmation inconsistency detected" || echo PASS | ||
141 | echo -n "Test for emergencies by count... " | 142 | echo -n "Test for emergencies by count... " |
142 | jq -e .emergencies_by_count[0] < test-audit.json > /dev/null && exit_fail "Unexpected emergency by count detected in ordinary run" || echo PASS | 143 | jq -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. | ||
1412 | function test_25() { | ||
1413 | |||
1414 | echo "===========25: deposits missing ===========" | ||
1415 | # Modify denom_sig, so it is wrong | ||
1416 | echo "DELETE FROM deposits;" | psql -Aqt $DB | ||
1417 | echo "DELETE FROM deposits WHERE deposit_serial_id=1;" | psql -Aqt $DB | ||
1418 | |||
1419 | run_audit | ||
1420 | |||
1421 | echo -n "Testing inconsistency detection... " | ||
1422 | |||
1423 | jq -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 | |||
1442 | echo PASS | ||
1443 | |||
1444 | # cannot easily undo DELETE, hence full reload | ||
1445 | echo -n "Reloading database ..." | ||
1446 | full_reload | ||
1447 | echo "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 ###### |