expand auditor test

This commit is contained in:
Christian Grothoff 2019-08-22 15:43:30 +02:00
parent 318f94bf90
commit 027f04a0f1
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC

View File

@ -1,14 +1,28 @@
#!/bin/bash
# Setup database which was generated from a perfectly normal
# exchange-wallet interaction and run the auditor against it.
#
# Check that the auditor report is as expected.
#
# Requires 'jq' tool and Postgres superuser rights!
set -eu
DB=taler-auditor-test
dropdb $DB || true
dropdb $DB 2> /dev/null || true
createdb -T template0 $DB || exit 77
psql $DB < ../benchmark/auditor-basedb.sql
jq -h > /dev/null || exit 77
psql $DB -q -1 -f ../benchmark/auditor-basedb.sql > /dev/null
MASTER_PUB=`cat ../benchmark/auditor-basedb.mpub`
taler-auditor -c test-auditor.conf -m $MASTER_PUB > test-audit.json
# TODO: check test-audit.json matches expectations
fail=0
# if an emergency was detected, that is a bug and we should fail
echo -n "Test for emergencies... "
jq -e .emergencies < test-audit.json > /dev/null && (echo Failed; fail=1) || echo OK
# TODO: Add more checks to ensure test-audit.json matches expectations
dropdb $DB
exit $fail