use shorter sleep, tolerate slight execution date disagreements between exchange and bank in auditor

This commit is contained in:
Christian Grothoff 2019-09-05 10:36:14 +02:00
parent e0979ecf5e
commit 1e685a0241
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
2 changed files with 41 additions and 12 deletions

View File

@ -40,6 +40,14 @@
*/ */
#define GRACE_PERIOD GNUNET_TIME_UNIT_HOURS #define GRACE_PERIOD GNUNET_TIME_UNIT_HOURS
/**
* How much do we allow the bank and the exchange to disagree about
* timestamps? Should be sufficiently large to avoid bogus reports from deltas
* created by imperfect clock synchronization and network delay.
*/
#define TIME_TOLERANCE GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, \
15)
/** /**
* Information we keep for each supported account. * Information we keep for each supported account.
@ -874,15 +882,34 @@ wire_out_cb (void *cls,
} }
goto cleanup; goto cleanup;
} }
if (roi->details.execution_date.abs_value_us !=
date.abs_value_us)
{ {
struct GNUNET_TIME_Relative delta;
if (roi->details.execution_date.abs_value_us >
date.abs_value_us)
delta = GNUNET_TIME_absolute_get_difference (date,
roi->details.execution_date);
else
delta = GNUNET_TIME_absolute_get_difference (roi->details.execution_date,
date);
if (delta.rel_value_us > TIME_TOLERANCE.rel_value_us)
{
char *details;
GNUNET_asprintf (&details,
"execution date missmatch (%s)",
GNUNET_STRINGS_relative_time_to_string (delta,
GNUNET_YES));
report (report_row_minor_inconsistencies, report (report_row_minor_inconsistencies,
json_pack ("{s:s, s:I, s:s}", json_pack ("{s:s, s:I, s:s}",
"table", "wire_out", "table", "wire_out",
"row", (json_int_t) rowid, "row", (json_int_t) rowid,
"diagnostic", "execution date missmatch")); "diagnostic", details));
GNUNET_free (details);
} }
}
cleanup: cleanup:
GNUNET_assert (GNUNET_OK == GNUNET_assert (GNUNET_OK ==
free_roi (NULL, free_roi (NULL,

View File

@ -46,7 +46,7 @@ function pre_audit () {
do do
echo -n "." echo -n "."
wget http://localhost:8082/ -o /dev/null -O /dev/null >/dev/null && break wget http://localhost:8082/ -o /dev/null -O /dev/null >/dev/null && break
sleep 1 sleep 0.1
done done
echo " DONE" echo " DONE"
@ -63,7 +63,7 @@ function audit_only () {
# Run the auditor! # Run the auditor!
echo -n "Running audit(s) ..." echo -n "Running audit(s) ..."
taler-auditor -r -c $CONF -m $MASTER_PUB > test-audit.json 2> test-audit.log || exit_fail "auditor failed" taler-auditor -r -c $CONF -m $MASTER_PUB > test-audit.json 2> test-audit.log || exit_fail "auditor failed"
echo -n "."
taler-wire-auditor -r -c $CONF -m $MASTER_PUB > test-wire-audit.json 2> test-wire-audit.log || exit_fail "wire auditor failed" taler-wire-auditor -r -c $CONF -m $MASTER_PUB > test-wire-audit.json 2> test-wire-audit.log || exit_fail "wire auditor failed"
echo " DONE" echo " DONE"
} }
@ -73,10 +73,12 @@ function audit_only () {
function post_audit () { function post_audit () {
kill `jobs -p` || true kill `jobs -p` || true
echo -n "TeXing ..." echo -n "TeXing ."
../../contrib/render.py test-audit.json test-wire-audit.json < ../../contrib/auditor-report.tex.j2 > test-report.tex || exit_fail "Renderer failed" ../../contrib/render.py test-audit.json test-wire-audit.json < ../../contrib/auditor-report.tex.j2 > test-report.tex || exit_fail "Renderer failed"
echo -n "."
timeout 10 pdflatex test-report.tex >/dev/null || exit_fail "pdflatex failed" timeout 10 pdflatex test-report.tex >/dev/null || exit_fail "pdflatex failed"
echo -n "."
timeout 10 pdflatex test-report.tex >/dev/null timeout 10 pdflatex test-report.tex >/dev/null
echo " DONE" echo " DONE"
} }
@ -711,7 +713,7 @@ run_audit
echo -n "Testing hung refresh detection... " echo -n "Testing hung refresh detection... "
HANG=`jq -er .refresh_hanging[0].amount < test-audit.json` HANG=`jq -er .refresh_hanging[0].amount < test-audit.json`
TOTAL_HANG=`jq -e .total_refresh_hanging < test-audit.json` TOTAL_HANG=`jq -er .total_refresh_hanging < test-audit.json`
if test x$HANG != x$TOTAL_HANG if test x$HANG != x$TOTAL_HANG
then then
exit_fail "Hanging amount inconsistent, got $HANG and $TOTAL_HANG" exit_fail "Hanging amount inconsistent, got $HANG and $TOTAL_HANG"