summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-09-05 10:36:14 +0200
committerChristian Grothoff <christian@grothoff.org>2019-09-05 10:36:14 +0200
commit1e685a02413b739545dfb5b677d66a327760a9df (patch)
tree5abe908a3b40f5fe25552ac39e1bb29b78e0dad2 /src
parente0979ecf5e3e55e5de80bcd4e9c15fd72c4c52ea (diff)
downloadexchange-1e685a02413b739545dfb5b677d66a327760a9df.tar.gz
exchange-1e685a02413b739545dfb5b677d66a327760a9df.tar.bz2
exchange-1e685a02413b739545dfb5b677d66a327760a9df.zip
use shorter sleep, tolerate slight execution date disagreements between exchange and bank in auditor
Diffstat (limited to 'src')
-rw-r--r--src/auditor/taler-wire-auditor.c41
-rwxr-xr-xsrc/auditor/test-auditor.sh12
2 files changed, 41 insertions, 12 deletions
diff --git a/src/auditor/taler-wire-auditor.c b/src/auditor/taler-wire-auditor.c
index e1af48883..85638fa76 100644
--- a/src/auditor/taler-wire-auditor.c
+++ b/src/auditor/taler-wire-auditor.c
@@ -40,6 +40,14 @@
*/
#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.
@@ -874,15 +882,34 @@ wire_out_cb (void *cls,
}
goto cleanup;
}
- if (roi->details.execution_date.abs_value_us !=
- date.abs_value_us)
+
{
- report (report_row_minor_inconsistencies,
- json_pack ("{s:s, s:I, s:s}",
- "table", "wire_out",
- "row", (json_int_t) rowid,
- "diagnostic", "execution date missmatch"));
+ 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,
+ json_pack ("{s:s, s:I, s:s}",
+ "table", "wire_out",
+ "row", (json_int_t) rowid,
+ "diagnostic", details));
+ GNUNET_free (details);
+ }
}
+
cleanup:
GNUNET_assert (GNUNET_OK ==
free_roi (NULL,
diff --git a/src/auditor/test-auditor.sh b/src/auditor/test-auditor.sh
index 222df84bf..aad233c7f 100755
--- a/src/auditor/test-auditor.sh
+++ b/src/auditor/test-auditor.sh
@@ -46,7 +46,7 @@ function pre_audit () {
do
echo -n "."
wget http://localhost:8082/ -o /dev/null -O /dev/null >/dev/null && break
- sleep 1
+ sleep 0.1
done
echo " DONE"
@@ -63,7 +63,7 @@ function audit_only () {
# Run the auditor!
echo -n "Running audit(s) ..."
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"
echo " DONE"
}
@@ -73,12 +73,14 @@ function audit_only () {
function post_audit () {
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"
+ echo -n "."
timeout 10 pdflatex test-report.tex >/dev/null || exit_fail "pdflatex failed"
+ echo -n "."
timeout 10 pdflatex test-report.tex >/dev/null
- echo "DONE"
+ echo " DONE"
}
@@ -711,7 +713,7 @@ run_audit
echo -n "Testing hung refresh detection... "
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
then
exit_fail "Hanging amount inconsistent, got $HANG and $TOTAL_HANG"