From 21cdab0fe225844753a0137872326960e83d9003 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Fri, 15 Apr 2022 16:00:10 +0200 Subject: tests: also sync in iban test --- src/cli/test_anastasis_reducer_recovery_no_pay.sh | 6 +++- src/cli/test_iban.sh | 36 +++++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/cli/test_anastasis_reducer_recovery_no_pay.sh b/src/cli/test_anastasis_reducer_recovery_no_pay.sh index f58980d..12ac7e9 100755 --- a/src/cli/test_anastasis_reducer_recovery_no_pay.sh +++ b/src/cli/test_anastasis_reducer_recovery_no_pay.sh @@ -2,6 +2,7 @@ # This file is in the public domain. set -eu +set -x # Exit, with status code "skip" (no 'real' failure) function exit_skip() { @@ -33,7 +34,8 @@ function sync_providers() { # Sync with providers (up to 3 providers aren't synced here) for x in 1 2 3; do echo "Synchronizing providers (round $x)" - anastasis-reducer sync_providers < $infile > $outfile 2> /dev/null || true + #anastasis-reducer sync_providers < $infile > $outfile 2> /dev/null || true + anastasis-reducer sync_providers < $infile > $outfile || true CODE=$(jq -r -e ".code // 0" < $outfile) # ANASTASIS_REDUCER_PROVIDERS_ALREADY_SYNCED # FIXME: Temporary workaround for C reducer. See #7227. @@ -265,6 +267,8 @@ sync_providers $R1FILE $R2FILE echo -n "Running challenge logic ..." +cat $R2FILE | jq . + UUID0=`jq -r -e .recovery_information.challenges[0].uuid < $R2FILE` UUID1=`jq -r -e .recovery_information.challenges[1].uuid < $R2FILE` UUID2=`jq -r -e .recovery_information.challenges[2].uuid < $R2FILE` diff --git a/src/cli/test_iban.sh b/src/cli/test_iban.sh index ce315b0..8278961 100755 --- a/src/cli/test_iban.sh +++ b/src/cli/test_iban.sh @@ -51,6 +51,36 @@ function prepare_sandbox_account() { echo " OK" } +function sync_providers() { + infile=$1 + outfile=$2 + echo "Synchronizing providers" + # Sync with providers (up to 3 providers aren't synced here) + for x in 1 2 3; do + echo "Synchronizing providers (round $x)" + anastasis-reducer sync_providers < $infile > $outfile 2> /dev/null || true + CODE=$(jq -r -e ".code // 0" < $outfile) + # ANASTASIS_REDUCER_PROVIDERS_ALREADY_SYNCED + # FIXME: Temporary workaround for C reducer. See #7227. + if test "$CODE" = "8420"; then + # restore previous non-error state + cat $infile > $outfile + break + fi + # ANASTASIS_REDUCER_ACTION_INVALID + if test "$CODE" = "8400"; then + # restore previous non-error state + cat $infile > $outfile + break + fi + if test "$CODE" != "0"; then + exit_fail "Expected no error or 8420/8400, got $CODE" + fi + cat $outfile > $infile + done + echo "Providers synced." +} + # Install cleanup handler (except for kill -9) trap cleanup EXIT @@ -315,6 +345,9 @@ anastasis-reducer -a \ "birthdate": "2000-01-01"}}' \ enter_user_attributes < $B1FILE > $B2FILE 2>> test_reducer.err echo -n "," +cat $B2FILE > $B1FILE +sync_providers $B1FILE $B2FILE +echo -n "," BASEIBAN=`echo -n $IBAN_DEBIT | gnunet-base32` anastasis-reducer -a \ "$(jq -n '{ authentication_method: { @@ -399,6 +432,9 @@ then fi echo " OK" +cat $R2FILE > $R1FILE +sync_providers $R1FILE $R2FILE + echo -n "Running challenge selection logic ..." UUID0=`jq -r -e .recovery_information.challenges[0].uuid < $R2FILE` -- cgit v1.2.3