aboutsummaryrefslogtreecommitdiff
path: root/src/cli/test_anastasis_reducer_recovery_no_pay.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/cli/test_anastasis_reducer_recovery_no_pay.sh')
-rwxr-xr-xsrc/cli/test_anastasis_reducer_recovery_no_pay.sh30
1 files changed, 16 insertions, 14 deletions
diff --git a/src/cli/test_anastasis_reducer_recovery_no_pay.sh b/src/cli/test_anastasis_reducer_recovery_no_pay.sh
index ca78705..e65c526 100755
--- a/src/cli/test_anastasis_reducer_recovery_no_pay.sh
+++ b/src/cli/test_anastasis_reducer_recovery_no_pay.sh
@@ -218,7 +218,7 @@ anastasis-reducer -a '{"provider_url" : "http://localhost:8086/" }' add_provider
218echo " OK" 218echo " OK"
219 219
220echo -n "Selecting secret to recover" 220echo -n "Selecting secret to recover"
221anastasis-reducer -a '{"attribute_mask": 0, "providers" : [ { "version": 0, "url" : "http://localhost:8086/" } ] }' select_version < $R1FILE > $R2FILE 221anastasis-reducer -a '{"attribute_mask": 0, "providers" : [ { "version": 1, "url" : "http://localhost:8086/" } ] }' select_version < $R1FILE > $R2FILE
222 222
223STATE=`jq -r -e .recovery_state < $R2FILE` 223STATE=`jq -r -e .recovery_state < $R2FILE`
224if test "$STATE" != "CHALLENGE_SELECTING" 224if test "$STATE" != "CHALLENGE_SELECTING"
@@ -228,19 +228,21 @@ fi
228echo " OK" 228echo " OK"
229 229
230echo -n "Synchronizing providers" 230echo -n "Synchronizing providers"
231anastasis-reducer sync_providers < $R2FILE > $R1FILE 231# Sync with providers (up to 3 providers aren't synced here)
232anastasis-reducer sync_providers < $R1FILE > $R2FILE 232for x in 1 2 3; do
233# This one will fail, as we should now have all 3 providers 233 echo "Synchronizing providers (round $x)"
234# used by the policy in sync! 234 anastasis-reducer sync_providers < $R2FILE > $R1FILE 2> /dev/null || true
235anastasis-reducer sync_providers < $R2FILE > $R1FILE 2> /dev/null || true 235 CODE=$(jq -r -e ".code // 0" < $R1FILE)
236# Note: continue with $R2FILE, the last one that was valid! 236 if test "$CODE" = "8420"; then
237 237 break
238CODE=`jq -r -e .code < $R1FILE` 238 fi
239if test "$CODE" != "8420" 239 if test "$CODE" != "0"; then
240then 240 exit_fail "Expected no error or 8420, got $CODE"
241 exit_fail "Expected to be synced, instead the code is '$CODE'" 241 fi
242fi 242 cat $R1FILE > $R2FILE
243echo " OK" 243done
244
245echo "Providers synced."
244 246
245 247
246echo -n "Running challenge logic ..." 248echo -n "Running challenge logic ..."