gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [taler-exchange] branch master updated: another test, more


From: gnunet
Subject: [GNUnet-SVN] [taler-exchange] branch master updated: another test, more fixes in auditor-report template
Date: Tue, 03 Sep 2019 03:14:37 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new 736927f0 another test, more fixes in auditor-report template
736927f0 is described below

commit 736927f05a19e0b88addd6829f49a5a9ddb025c4
Author: Christian Grothoff <address@hidden>
AuthorDate: Tue Sep 3 03:14:23 2019 +0200

    another test, more fixes in auditor-report template
---
 contrib/auditor-report.tex.j2 | 22 +++++++++------
 src/auditor/test-auditor.sh   | 65 ++++++++++++++++++++++++++++++++++++++++---
 2 files changed, 74 insertions(+), 13 deletions(-)

diff --git a/contrib/auditor-report.tex.j2 b/contrib/auditor-report.tex.j2
index b03bf823..2216d8d0 100644
--- a/contrib/auditor-report.tex.j2
+++ b/contrib/auditor-report.tex.j2
@@ -446,26 +446,30 @@ public key for ``payback-master'' operations.
 {% if data.bad_sig_losses|length() == 0 %}
   {\bf All signatures were valid.}
 {% else %}
-  \begin{longtable}{p{1.5cm}|c|l|r}
-  {\bf Public key} & {\bf Operation type} & Database row & {\bf Loss amount} \\
+  \begin{longtable}{c|r|r}
+  \multicolumn{3}{l}{ {\bf Public key} }\\
+  {\bf Operation type} & Database row & {\bf Loss amount} \\
   \hline \hline
 \endfirsthead
-  {\bf Public key} & {\bf Operation type} & Database row & {\bf Loss amount} 
\\ \hline \hline
+  \multicolumn{3}{l}{ {\bf Public key} }\\
+  {\bf Operation type} & Database row & {\bf Loss amount} \\ \hline \hline
 \endhead
   \hline \hline
-  {\bf Public key} & {\bf Operation type} & Database row & {\bf Loss amount} \\
+  \multicolumn{3}{l}{ {\bf Public key} }\\
+  {\bf Operation type} & Database row & {\bf Loss amount} \\
 \endfoot
   \hline
-  {\bf Total losses}  & & &
-  {{ data.total_bad_sig_loss}} \\
+  {\bf Total losses}  & & 
+  {\bf {{ data.total_bad_sig_loss}} } \\
   \caption{Losses from operations performed on coins without proper 
signatures.}
   \label{table:bad_signature_losses}
 \endlastfoot
 {% for item in data.bad_sig_losses %}
-  \multicolumn{5}{l}{ {\tt \small {{ item.key_pub }} } } \\
+  \multicolumn{3}{l}{ {\tt \small {{ item.key_pub }} } } \\
 \nopagebreak
-  & {{ item.operation }} & {{ item.rowid }} &
-    {{ item.loss }} \\ \hline
+  {{ item.operation }} &
+  {{ item.row }} &
+  {{ item.loss }} \\ \hline
 {% endfor %}
   \end{longtable}
 {% endif %}
diff --git a/src/auditor/test-auditor.sh b/src/auditor/test-auditor.sh
index f8370fe4..8122307c 100755
--- a/src/auditor/test-auditor.sh
+++ b/src/auditor/test-auditor.sh
@@ -7,25 +7,37 @@
 # Requires 'jq' tool and Postgres superuser rights!
 set -eu
 
-# Which tests should we run, used to make it easy to
+# Set of numbers for all the testcases.
+# When adding new tests, increase the last number:
+ALL_TESTS=`seq 1 4`
+
+# $TESTS determines which tests we should run.
+# This construction is used to make it easy to
 # only run a subset of the tests. To only run a subset,
 # pass the numbers of the tests to run as the FIRST
-# argument to test-auditor.sh
-ALL_TESTS=`seq 1 3`
+# argument to test-auditor.sh, i.e.:
+#
+# $ test-auditor.sh "1 3"
+#
+# to run tests 1 and 3 only.  By default, all tests are run.
+#
 TESTS=${1:-$ALL_TESTS}
 
-
+# Exit, with status code "skip" (no 'real' failure)
 function exit_skip() {
     echo $1
     exit 77
 }
 
+# Exit, with error message (hard failure)
 function exit_fail() {
     echo $1
     kill `jobs -p`
     exit 1
 }
 
+# Run audit process on current database, including report
+# generation.
 function run_audit () {
     # Launch bank
     echo "Launching bank"
@@ -234,6 +246,51 @@ echo "UPDATE reserves_in SET credit_val=10 WHERE 
reserve_in_serial_id=1" | psql
 }
 
 
+# Check for incoming wire transfer amount given being
+# lower than what exchange claims to have received.
+test_4() {
+
+echo "===========4: deposit wire target wrong================="
+# Original target bank account was 43, changing to 44
+echo "UPDATE deposits SET 
wire='{\"url\":\"payto://x-taler-bank/localhost:8082/44\",\"salt\":\"test-salt 
(must be constant for aggregation tests)\"}' WHERE deposit_serial_id=1" | psql 
$DB
+
+run_audit
+
+ROW=`jq -e .bad_sig_losses[0].row < test-audit.json`
+if test $ROW != 1
+then
+    exit_fail "Row wrong, got $ROW"
+fi
+
+LOSS=`jq -r .bad_sig_losses[0].loss < test-audit.json`
+if test $LOSS != "TESTKUDOS:0.1"
+then
+    exit_fail "Wrong deposit bad signature loss, got $LOSS"
+fi
+
+OP=`jq -r .bad_sig_losses[0].operation < test-audit.json`
+if test $OP != "deposit"
+then
+    exit_fail "Wrong operation, got $OP"
+fi
+
+LOSS=`jq -r .total_bad_sig_loss < test-audit.json`
+if test $LOSS != "TESTKUDOS:0.1"
+then
+    exit_fail "Wrong total bad sig loss, got $LOSS"
+fi
+
+# Undo:
+echo "UPDATE deposits SET 
wire='{\"url\":\"payto://x-taler-bank/localhost:8082/43\",\"salt\":\"test-salt 
(must be constant for aggregation tests)\"}' WHERE deposit_serial_id=1" | psql 
$DB
+
+}
+
+
+
+
+
+# Add more tests here! :-)
+
 fail=0
 for i in $TESTS
 do

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]