diff options
author | Christian Grothoff <christian@grothoff.org> | 2019-09-05 10:36:14 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2019-09-05 10:36:14 +0200 |
commit | 1e685a02413b739545dfb5b677d66a327760a9df (patch) | |
tree | 5abe908a3b40f5fe25552ac39e1bb29b78e0dad2 | |
parent | e0979ecf5e3e55e5de80bcd4e9c15fd72c4c52ea (diff) | |
download | exchange-1e685a02413b739545dfb5b677d66a327760a9df.tar.gz exchange-1e685a02413b739545dfb5b677d66a327760a9df.zip |
use shorter sleep, tolerate slight execution date disagreements between exchange and bank in auditor
-rw-r--r-- | src/auditor/taler-wire-auditor.c | 41 | ||||
-rwxr-xr-x | src/auditor/test-auditor.sh | 12 |
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 @@ | |||
40 | */ | 40 | */ |
41 | #define GRACE_PERIOD GNUNET_TIME_UNIT_HOURS | 41 | #define GRACE_PERIOD GNUNET_TIME_UNIT_HOURS |
42 | 42 | ||
43 | /** | ||
44 | * How much do we allow the bank and the exchange to disagree about | ||
45 | * timestamps? Should be sufficiently large to avoid bogus reports from deltas | ||
46 | * created by imperfect clock synchronization and network delay. | ||
47 | */ | ||
48 | #define TIME_TOLERANCE GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, \ | ||
49 | 15) | ||
50 | |||
43 | 51 | ||
44 | /** | 52 | /** |
45 | * Information we keep for each supported account. | 53 | * Information we keep for each supported account. |
@@ -874,15 +882,34 @@ wire_out_cb (void *cls, | |||
874 | } | 882 | } |
875 | goto cleanup; | 883 | goto cleanup; |
876 | } | 884 | } |
877 | if (roi->details.execution_date.abs_value_us != | 885 | |
878 | date.abs_value_us) | ||
879 | { | 886 | { |
880 | report (report_row_minor_inconsistencies, | 887 | struct GNUNET_TIME_Relative delta; |
881 | json_pack ("{s:s, s:I, s:s}", | 888 | |
882 | "table", "wire_out", | 889 | if (roi->details.execution_date.abs_value_us > |
883 | "row", (json_int_t) rowid, | 890 | date.abs_value_us) |
884 | "diagnostic", "execution date missmatch")); | 891 | delta = GNUNET_TIME_absolute_get_difference (date, |
892 | roi->details.execution_date); | ||
893 | else | ||
894 | delta = GNUNET_TIME_absolute_get_difference (roi->details.execution_date, | ||
895 | date); | ||
896 | if (delta.rel_value_us > TIME_TOLERANCE.rel_value_us) | ||
897 | { | ||
898 | char *details; | ||
899 | |||
900 | GNUNET_asprintf (&details, | ||
901 | "execution date missmatch (%s)", | ||
902 | GNUNET_STRINGS_relative_time_to_string (delta, | ||
903 | GNUNET_YES)); | ||
904 | report (report_row_minor_inconsistencies, | ||
905 | json_pack ("{s:s, s:I, s:s}", | ||
906 | "table", "wire_out", | ||
907 | "row", (json_int_t) rowid, | ||
908 | "diagnostic", details)); | ||
909 | GNUNET_free (details); | ||
910 | } | ||
885 | } | 911 | } |
912 | |||
886 | cleanup: | 913 | cleanup: |
887 | GNUNET_assert (GNUNET_OK == | 914 | GNUNET_assert (GNUNET_OK == |
888 | free_roi (NULL, | 915 | 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 () { | |||
46 | do | 46 | do |
47 | echo -n "." | 47 | echo -n "." |
48 | wget http://localhost:8082/ -o /dev/null -O /dev/null >/dev/null && break | 48 | wget http://localhost:8082/ -o /dev/null -O /dev/null >/dev/null && break |
49 | sleep 1 | 49 | sleep 0.1 |
50 | done | 50 | done |
51 | echo " DONE" | 51 | echo " DONE" |
52 | 52 | ||
@@ -63,7 +63,7 @@ function audit_only () { | |||
63 | # Run the auditor! | 63 | # Run the auditor! |
64 | echo -n "Running audit(s) ..." | 64 | echo -n "Running audit(s) ..." |
65 | taler-auditor -r -c $CONF -m $MASTER_PUB > test-audit.json 2> test-audit.log || exit_fail "auditor failed" | 65 | taler-auditor -r -c $CONF -m $MASTER_PUB > test-audit.json 2> test-audit.log || exit_fail "auditor failed" |
66 | 66 | echo -n "." | |
67 | taler-wire-auditor -r -c $CONF -m $MASTER_PUB > test-wire-audit.json 2> test-wire-audit.log || exit_fail "wire auditor failed" | 67 | taler-wire-auditor -r -c $CONF -m $MASTER_PUB > test-wire-audit.json 2> test-wire-audit.log || exit_fail "wire auditor failed" |
68 | echo " DONE" | 68 | echo " DONE" |
69 | } | 69 | } |
@@ -73,12 +73,14 @@ function audit_only () { | |||
73 | function post_audit () { | 73 | function post_audit () { |
74 | kill `jobs -p` || true | 74 | kill `jobs -p` || true |
75 | 75 | ||
76 | echo -n "TeXing ..." | 76 | echo -n "TeXing ." |
77 | ../../contrib/render.py test-audit.json test-wire-audit.json < ../../contrib/auditor-report.tex.j2 > test-report.tex || exit_fail "Renderer failed" | 77 | ../../contrib/render.py test-audit.json test-wire-audit.json < ../../contrib/auditor-report.tex.j2 > test-report.tex || exit_fail "Renderer failed" |
78 | 78 | ||
79 | echo -n "." | ||
79 | timeout 10 pdflatex test-report.tex >/dev/null || exit_fail "pdflatex failed" | 80 | timeout 10 pdflatex test-report.tex >/dev/null || exit_fail "pdflatex failed" |
81 | echo -n "." | ||
80 | timeout 10 pdflatex test-report.tex >/dev/null | 82 | timeout 10 pdflatex test-report.tex >/dev/null |
81 | echo "DONE" | 83 | echo " DONE" |
82 | } | 84 | } |
83 | 85 | ||
84 | 86 | ||
@@ -711,7 +713,7 @@ run_audit | |||
711 | echo -n "Testing hung refresh detection... " | 713 | echo -n "Testing hung refresh detection... " |
712 | 714 | ||
713 | HANG=`jq -er .refresh_hanging[0].amount < test-audit.json` | 715 | HANG=`jq -er .refresh_hanging[0].amount < test-audit.json` |
714 | TOTAL_HANG=`jq -e .total_refresh_hanging < test-audit.json` | 716 | TOTAL_HANG=`jq -er .total_refresh_hanging < test-audit.json` |
715 | if test x$HANG != x$TOTAL_HANG | 717 | if test x$HANG != x$TOTAL_HANG |
716 | then | 718 | then |
717 | exit_fail "Hanging amount inconsistent, got $HANG and $TOTAL_HANG" | 719 | exit_fail "Hanging amount inconsistent, got $HANG and $TOTAL_HANG" |