expand test suite
This commit is contained in:
parent
62b8ca0bd3
commit
8a90c8fbcb
@ -509,6 +509,7 @@ easily determined from the amounts and thus not included in the totals.
|
|||||||
\subsubsection{For coins}
|
\subsubsection{For coins}
|
||||||
|
|
||||||
% Table generation tested by testcase #18 in test-auditor.sh
|
% Table generation tested by testcase #18 in test-auditor.sh
|
||||||
|
% Table generation tested by testcase #3 in test-revocation.sh
|
||||||
|
|
||||||
{% if coins.amount_arithmetic_inconsistencies|length() == 0 %}
|
{% if coins.amount_arithmetic_inconsistencies|length() == 0 %}
|
||||||
{\bf No arithmetic problems detected.}
|
{\bf No arithmetic problems detected.}
|
||||||
@ -541,7 +542,7 @@ easily determined from the amounts and thus not included in the totals.
|
|||||||
|
|
||||||
\subsubsection{For reserves}
|
\subsubsection{For reserves}
|
||||||
|
|
||||||
% Table generation tested by testcase #XX in test-auditor.sh
|
% Table generation tested by testcase #2 in test-auditor.sh
|
||||||
|
|
||||||
{% if reserves.amount_arithmetic_inconsistencies|length() == 0 %}
|
{% if reserves.amount_arithmetic_inconsistencies|length() == 0 %}
|
||||||
{\bf No arithmetic problems detected.}
|
{\bf No arithmetic problems detected.}
|
||||||
@ -752,6 +753,7 @@ public key for ``recoup-master'' operations.
|
|||||||
\subsubsection{For coins}
|
\subsubsection{For coins}
|
||||||
|
|
||||||
% Table generation tested by testcase #4/#5/#6/#13 in test-auditor.sh
|
% Table generation tested by testcase #4/#5/#6/#13 in test-auditor.sh
|
||||||
|
% Table generation tested by testcase #4 in test-revocation.sh
|
||||||
|
|
||||||
{% if coins.bad_sig_losses|length() == 0 %}
|
{% if coins.bad_sig_losses|length() == 0 %}
|
||||||
{\bf All signatures were valid.}
|
{\bf All signatures were valid.}
|
||||||
@ -775,7 +777,7 @@ public key for ``recoup-master'' operations.
|
|||||||
\label{table:bad_signature_losses}
|
\label{table:bad_signature_losses}
|
||||||
\endlastfoot
|
\endlastfoot
|
||||||
{% for item in coins.bad_sig_losses %}
|
{% for item in coins.bad_sig_losses %}
|
||||||
\multicolumn{3}{l}{ {\tt \small \truncate{0.9\textwidth}{ {{ item.key_pub }} } } } \\
|
\multicolumn{3}{l}{ {\tt \small \truncate{0.9\textwidth}{ {{ item.coin_pub }} } } } \\
|
||||||
\nopagebreak
|
\nopagebreak
|
||||||
{{ item.operation }} &
|
{{ item.operation }} &
|
||||||
{{ item.row }} &
|
{{ item.row }} &
|
||||||
@ -974,6 +976,7 @@ Deltas may indicate a corrupt database, but do not necessarily
|
|||||||
translate into a financial loss (yet).
|
translate into a financial loss (yet).
|
||||||
|
|
||||||
% Table generation tested by testcase #3 in test-auditor.sh
|
% Table generation tested by testcase #3 in test-auditor.sh
|
||||||
|
% Table generation tested by testcase #4 in test-revocation.sh
|
||||||
|
|
||||||
{% if reserves.reserve_balance_summary_wrong_inconsistencies|length() == 0 %}
|
{% if reserves.reserve_balance_summary_wrong_inconsistencies|length() == 0 %}
|
||||||
{\bf All balances matched up.}
|
{\bf All balances matched up.}
|
||||||
@ -1065,8 +1068,7 @@ have a clear financial impact.
|
|||||||
This section describes issues found by the wire auditor that
|
This section describes issues found by the wire auditor that
|
||||||
relate to outgoing wire transfers subjects being duplicated.
|
relate to outgoing wire transfers subjects being duplicated.
|
||||||
|
|
||||||
% Table generation tested by testcase #XX in test-auditor.sh
|
% Table generation tested by testcase #27 in test-auditor.sh
|
||||||
% TODO: test this! #6054
|
|
||||||
|
|
||||||
{% if wire.wire_format_inconsistencies|length() == 0 %}
|
{% if wire.wire_format_inconsistencies|length() == 0 %}
|
||||||
{\bf No wire format inconsistencies found.}
|
{\bf No wire format inconsistencies found.}
|
||||||
@ -1081,7 +1083,7 @@ relate to outgoing wire transfers subjects being duplicated.
|
|||||||
\hline \hline
|
\hline \hline
|
||||||
\endhead
|
\endhead
|
||||||
\hline
|
\hline
|
||||||
\multicolumn{2}{c}{ {\bf Row (base32)} } \\
|
\multicolumn{2}{c}{ {\bf Diagnostic} } \\
|
||||||
{\bf Row (base32)} & {\bf Amount} \\
|
{\bf Row (base32)} & {\bf Amount} \\
|
||||||
\endfoot
|
\endfoot
|
||||||
\hline
|
\hline
|
||||||
@ -1200,7 +1202,7 @@ impact.
|
|||||||
|
|
||||||
\subsubsection{For reserves}
|
\subsubsection{For reserves}
|
||||||
|
|
||||||
% Table generation tested by testcase #XX in test-auditor.sh
|
% Table generation tested by testcase #4 in test-revocation.sh
|
||||||
|
|
||||||
{% if reserves.row_inconsistencies|length() == 0 %}
|
{% if reserves.row_inconsistencies|length() == 0 %}
|
||||||
{\bf No row inconsistencies found.}
|
{\bf No row inconsistencies found.}
|
||||||
|
@ -352,7 +352,7 @@ echo "OK"
|
|||||||
# Change amount of wire transfer reported by exchange
|
# Change amount of wire transfer reported by exchange
|
||||||
function test_2() {
|
function test_2() {
|
||||||
|
|
||||||
echo "===========2: reserves_in inconsitency==========="
|
echo "===========2: reserves_in inconsistency==========="
|
||||||
echo "UPDATE reserves_in SET credit_val=5 WHERE reserve_in_serial_id=1" | psql -Aqt $DB
|
echo "UPDATE reserves_in SET credit_val=5 WHERE reserve_in_serial_id=1" | psql -Aqt $DB
|
||||||
|
|
||||||
run_audit
|
run_audit
|
||||||
@ -396,7 +396,7 @@ echo "UPDATE reserves_in SET credit_val=10 WHERE reserve_in_serial_id=1" | psql
|
|||||||
# lower than what exchange claims to have received.
|
# lower than what exchange claims to have received.
|
||||||
function test_3() {
|
function test_3() {
|
||||||
|
|
||||||
echo "===========3: reserves_in inconsitency==========="
|
echo "===========3: reserves_in inconsistency==========="
|
||||||
echo "UPDATE reserves_in SET credit_val=15 WHERE reserve_in_serial_id=1" | psql -Aqt $DB
|
echo "UPDATE reserves_in SET credit_val=15 WHERE reserve_in_serial_id=1" | psql -Aqt $DB
|
||||||
|
|
||||||
run_audit
|
run_audit
|
||||||
@ -1443,7 +1443,6 @@ function test_25() {
|
|||||||
|
|
||||||
echo "=========25: inconsistent coin history========="
|
echo "=========25: inconsistent coin history========="
|
||||||
|
|
||||||
# Check wire transfer lag reported (no aggregator!)
|
|
||||||
# NOTE: This test is EXPECTED to fail for ~1h after
|
# NOTE: This test is EXPECTED to fail for ~1h after
|
||||||
# re-generating the test database as we do not
|
# re-generating the test database as we do not
|
||||||
# report lag of less than 1h (see GRACE_PERIOD in
|
# report lag of less than 1h (see GRACE_PERIOD in
|
||||||
@ -1729,6 +1728,38 @@ fi
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Test where denom_sig in known_coins table is wrong
|
||||||
|
# (=> bad signature)
|
||||||
|
function test_32() {
|
||||||
|
|
||||||
|
# NOTE: This test is EXPECTED to fail for ~1h after
|
||||||
|
# re-generating the test database as we do not
|
||||||
|
# report lag of less than 1h (see GRACE_PERIOD in
|
||||||
|
# taler-helper-auditor-wire.c)
|
||||||
|
if [ $DATABASE_AGE -gt 3600 ]
|
||||||
|
then
|
||||||
|
|
||||||
|
echo "===========32: known_coins signature wrong w. aggregation================="
|
||||||
|
# Modify denom_sig, so it is wrong
|
||||||
|
OLD_SIG=`echo 'SELECT denom_sig FROM known_coins LIMIT 1;' | psql $DB -Aqt`
|
||||||
|
COIN_PUB=`echo "SELECT coin_pub FROM known_coins WHERE denom_sig='$OLD_SIG';" | psql $DB -Aqt`
|
||||||
|
echo "UPDATE known_coins SET denom_sig='\x287369672d76616c200a2028727361200a2020287320233542383731423743393036444643303442424430453039353246413642464132463537303139374131313437353746324632323332394644443146324643333445393939413336363430334233413133324444464239413833353833464536354442374335434445304441453035374438363336434541423834463843323843344446304144363030343430413038353435363039373833434431333239393736423642433437313041324632414132414435413833303432434346314139464635394244434346374436323238344143354544364131373739463430353032323241373838423837363535453434423145443831364244353638303232413123290a2020290a20290b' WHERE coin_pub='$COIN_PUB'" | psql -Aqt $DB
|
||||||
|
|
||||||
|
run_audit aggregation
|
||||||
|
|
||||||
|
# FIXME: test incomplete...
|
||||||
|
|
||||||
|
# Cannot undo aggregation, do full reload
|
||||||
|
full_reload
|
||||||
|
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# *************** Main test loop starts here **************
|
# *************** Main test loop starts here **************
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ set -eu
|
|||||||
|
|
||||||
# Set of numbers for all the testcases.
|
# Set of numbers for all the testcases.
|
||||||
# When adding new tests, increase the last number:
|
# When adding new tests, increase the last number:
|
||||||
ALL_TESTS=`seq 0 1`
|
ALL_TESTS=`seq 0 4`
|
||||||
|
|
||||||
# $TESTS determines which tests we should run.
|
# $TESTS determines which tests we should run.
|
||||||
# This construction is used to make it easy to
|
# This construction is used to make it easy to
|
||||||
@ -344,12 +344,106 @@ if test $WIRED != "TESTKUDOS:0"
|
|||||||
then
|
then
|
||||||
exit_fail "Expected total missattribution in wrong, got $WIRED"
|
exit_fail "Expected total missattribution in wrong, got $WIRED"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Database was unmodified, no need to undo
|
# Database was unmodified, no need to undo
|
||||||
echo "OK"
|
echo "OK"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Change recoup amount
|
||||||
|
function test_2() {
|
||||||
|
|
||||||
|
echo "===========2: recoup amount inconsistency==========="
|
||||||
|
echo "UPDATE recoup SET amount_val=5 WHERE recoup_uuid=1" | psql -Aqt $DB
|
||||||
|
|
||||||
|
run_audit
|
||||||
|
|
||||||
|
# Reserve balance is now wrong
|
||||||
|
echo -n "Testing inconsistency detection... "
|
||||||
|
AMOUNT=`jq -r .reserve_balance_summary_wrong_inconsistencies[0].auditor < test-audit-reserves.json`
|
||||||
|
if test $AMOUNT != "TESTKUDOS:3"
|
||||||
|
then
|
||||||
|
exit_fail "Auditor amount $AMOUNT is wrong"
|
||||||
|
fi
|
||||||
|
AMOUNT=`jq -r .reserve_balance_summary_wrong_inconsistencies[0].exchange < test-audit-reserves.json`
|
||||||
|
if test $AMOUNT != "TESTKUDOS:0"
|
||||||
|
then
|
||||||
|
exit_fail "Exchange amount $AMOUNT is wrong"
|
||||||
|
fi
|
||||||
|
# Coin spent exceeded coin's value
|
||||||
|
AMOUNT=`jq -r .amount_arithmetic_inconsistencies[0].auditor < test-audit-coins.json`
|
||||||
|
if test $AMOUNT != "TESTKUDOS:2"
|
||||||
|
then
|
||||||
|
exit_fail "Auditor amount $AMOUNT is wrong"
|
||||||
|
fi
|
||||||
|
AMOUNT=`jq -r .amount_arithmetic_inconsistencies[0].exchange < test-audit-coins.json`
|
||||||
|
if test $AMOUNT != "TESTKUDOS:5"
|
||||||
|
then
|
||||||
|
exit_fail "Exchange amount $AMOUNT is wrong"
|
||||||
|
fi
|
||||||
|
echo OK
|
||||||
|
|
||||||
|
# Undo database modification
|
||||||
|
echo "UPDATE recoup SET amount_val=2 WHERE recoup_uuid=1" | psql -Aqt $DB
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Change recoup-refresh amount
|
||||||
|
function test_3() {
|
||||||
|
|
||||||
|
echo "===========3: recoup-refresh amount inconsistency==========="
|
||||||
|
echo "UPDATE recoup_refresh SET amount_val=5 WHERE recoup_refresh_uuid=1" | psql -Aqt $DB
|
||||||
|
|
||||||
|
run_audit
|
||||||
|
|
||||||
|
echo -n "Testing inconsistency detection... "
|
||||||
|
# Coin spent exceeded coin's value
|
||||||
|
AMOUNT=`jq -r .total_arithmetic_delta_minus < test-audit-coins.json`
|
||||||
|
if test $AMOUNT != "TESTKUDOS:5"
|
||||||
|
then
|
||||||
|
exit_fail "Arithmetic delta minus amount $AMOUNT is wrong"
|
||||||
|
fi
|
||||||
|
AMOUNT=`jq -r .total_arithmetic_delta_plus < test-audit-coins.json`
|
||||||
|
if test $AMOUNT != "TESTKUDOS:0"
|
||||||
|
then
|
||||||
|
exit_fail "Arithmetic delta plus amount $AMOUNT is wrong"
|
||||||
|
fi
|
||||||
|
echo OK
|
||||||
|
|
||||||
|
# Undo database modification
|
||||||
|
echo "UPDATE recoup_refresh SET amount_val=0 WHERE recoup_refresh_uuid=1" | psql -Aqt $DB
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Void recoup-refresh entry by 'unrevoking' denomination
|
||||||
|
function test_4() {
|
||||||
|
|
||||||
|
echo "===========4: invalid recoup==========="
|
||||||
|
echo "DELETE FROM denomination_revocations;" | psql -Aqt $DB
|
||||||
|
|
||||||
|
run_audit
|
||||||
|
|
||||||
|
echo -n "Testing inconsistency detection... "
|
||||||
|
# Coin spent exceeded coin's value
|
||||||
|
jq -e .bad_sig_losses[0] < test-audit-coins.json > /dev/null || exit_fail "Bad recoup not detected"
|
||||||
|
AMOUNT=`jq -r .total_bad_sig_losses < test-audit-coins.json`
|
||||||
|
if test $AMOUNT == "TESTKUDOS:0"
|
||||||
|
then
|
||||||
|
exit_fail "Total bad sig losses are wrong"
|
||||||
|
fi
|
||||||
|
echo OK
|
||||||
|
|
||||||
|
# Undo database modification (can't easily undo DELETE, so full reload)
|
||||||
|
full_reload
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# *************** Main test loop starts here **************
|
# *************** Main test loop starts here **************
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user