aboutsummaryrefslogtreecommitdiff
path: root/src/auditor/test-auditor.sh
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-02-08 17:41:27 +0100
committerChristian Grothoff <christian@grothoff.org>2020-02-08 17:41:27 +0100
commit964cd7a459763a3ddc21f2b32f81a1dad5b7a4ce (patch)
tree577cedacb6be5a9374e6b24e1f2fb3cb5e913f20 /src/auditor/test-auditor.sh
parent3d90810f0092476ba4d37c135c430b11783da373 (diff)
adding test for #6054 (duplicate WTID)
Diffstat (limited to 'src/auditor/test-auditor.sh')
-rwxr-xr-xsrc/auditor/test-auditor.sh43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/auditor/test-auditor.sh b/src/auditor/test-auditor.sh
index 00ed05230..5f7d0c8c3 100755
--- a/src/auditor/test-auditor.sh
+++ b/src/auditor/test-auditor.sh
@@ -1473,6 +1473,49 @@ echo "UPDATE deposits SET wire='$OLD_WIRE' WHERE deposit_serial_id=${SERIAL}" |
}
+# Test for duplicate wire transfer subject
+function test_27() {
+echo "===========27: duplicate WTID detection ================="
+
+# Check wire transfer lag reported (no aggregator!)
+# NOTE: This test is EXPECTED to fail for ~1h after
+# re-generating the test database as we do not
+# report lag of less than 1h (see GRACE_PERIOD in
+# taler-wire-auditor.c)
+if [ $DATABASE_AGE -gt 3600 ]
+then
+
+ pre_audit aggregator
+
+ # Obtain data to duplicate.
+ ID=`echo "SELECT id FROM app_banktransaction WHERE debit_account_id=2 LIMIT 1" | psql $DB -Aqt`
+ WTID=`echo "SELECT subject FROM app_banktransaction WHERE debit_account_id=2 LIMIT 1" | psql $DB -Aqt`
+ echo "INSERT INTO app_banktransaction (amount,subject,date,credit_account_id,debit_account_id,cancelled) VALUES ('TESTKUDOS:1','$WTID',NOW(),12,2,'f')" | psql -Aqt $DB
+
+ audit_only
+ post_audit
+
+ echo -n "Testing inconsistency detection... "
+
+ AMOUNT=`jq -r .wire_format_inconsistencies[0].amount < test-wire-audit.json`
+ if test "${AMOUNT}" != "TESTKUDOS:1"
+ then
+ exit_fail "Amount wrong, got ${AMOUNT}"
+ fi
+
+ AMOUNT=`jq -r .total_wire_format_amount < test-wire-audit.json`
+ if test "${AMOUNT}" != "TESTKUDOS:1"
+ then
+ exit_fail "Wrong total wire format amount, got $AMOUNT"
+ fi
+
+ # cannot easily undo aggregator, hence full reload
+ full_reload
+else
+ echo "Test skipped (database too new)"
+fi
+
+}
# **************************************************