exchange/src/auditor/test-sync.sh

44 lines
1.3 KiB
Bash
Raw Normal View History

2021-01-13 19:47:45 +01:00
#!/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
2021-01-13 19:47:45 +01:00
2022-02-28 21:02:12 +01:00
# cs_nonce_locks excluded: no point
for table in denominations denomination_revocations wire_targets reserves reserves_in reserves_close reserves_out auditors auditor_denom_sigs exchange_sign_keys signkey_revocations extensions extension_details known_coins refresh_commitments refresh_revealed_coins refresh_transfer_keys deposits refunds wire_out aggregation_tracking wire_fee recoup recoup_refresh
2021-01-13 19:47:45 +01:00
do
echo -n "."
2022-08-06 21:51:39 +02:00
CIN=`echo "SELECT COUNT(*) FROM exchange.$table" | psql talercheck-in -Aqt`
COUT=`echo "SELECT COUNT(*) FROM exchange.$table" | psql talercheck-out -Aqt`
2021-01-13 19:47:45 +01:00
if test ${CIN} != ${COUT}
then
dropdb talercheck-in
dropdb talercheck-out
echo "FAIL"
2021-04-23 23:53:52 +02:00
echo "Record count mismatch: $CIN / $COUT in table $table"
2021-01-13 19:47:45 +01:00
exit 1
fi
done
echo -n ". "
dropdb talercheck-in
dropdb talercheck-out
echo "PASS"
exit 0