diff options
author | Christian Grothoff <christian@grothoff.org> | 2021-01-13 19:47:45 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2021-01-13 19:47:45 +0100 |
commit | e3a0bc0d1f1d14123b56b041b475c8090d20ec1c (patch) | |
tree | b765a4c2d22baa25c4dd458bd703a3f95b71bbb0 /src/auditor/test-sync.sh | |
parent | 52513dcc2690716bb88cba506088b0422a53eb4a (diff) | |
download | exchange-e3a0bc0d1f1d14123b56b041b475c8090d20ec1c.tar.gz exchange-e3a0bc0d1f1d14123b56b041b475c8090d20ec1c.tar.bz2 exchange-e3a0bc0d1f1d14123b56b041b475c8090d20ec1c.zip |
fix sync issues, add rudimentary test
Diffstat (limited to 'src/auditor/test-sync.sh')
-rwxr-xr-x | src/auditor/test-sync.sh | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/auditor/test-sync.sh b/src/auditor/test-sync.sh new file mode 100755 index 00000000..156df9cc --- /dev/null +++ b/src/auditor/test-sync.sh @@ -0,0 +1,42 @@ +#!/bin/sh + +set -eu + +echo -n "Testing synchronization logic ..." + +dropdb talercheck-in 2> /dev/null || true +dropdb talercheck-out 2> /dev/null || true + +createdb talercheck-in || exit 77 +createdb talercheck-out || exit 77 +echo -n "." + +taler-exchange-dbinit -c test-sync-out.conf +echo -n "." +psql talercheck-in < auditor-basedb.sql >/dev/null 2> /dev/null + +echo -n "." +taler-auditor-sync -s test-sync-in.conf -d test-sync-out.conf -t + +for table in denominations denomination_revocations reserves reserves_in reserves_close reserves_out auditors auditor_denom_sigs exchange_sign_keys signkey_revocations known_coins refresh_commitments refresh_revealed_coins refresh_transfer_keys deposits refunds wire_out aggregation_tracking wire_fee recoup recoup_refresh +do + echo -n "." + CIN=`echo "SELECT COUNT(*) FROM $table" | psql talercheck-in -Aqt` + COUT=`echo "SELECT COUNT(*) FROM $table" | psql talercheck-out -Aqt` + + if test ${CIN} != ${COUT} + then + dropdb talercheck-in + dropdb talercheck-out + echo "FAIL" + echo "Record count missmatch: $CIN / $COUT in table $table" + exit 1 + fi +done + +echo -n ". " +dropdb talercheck-in +dropdb talercheck-out + +echo "PASS" +exit 0 |