aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2022-04-14 20:57:46 +0200
committerFlorian Dold <florian@dold.me>2022-04-14 20:57:46 +0200
commitd1d097c5bb69230df6d279e4286e7e6a9f0f49f2 (patch)
treeabd75e060353a4353d834e7828cb0cfd53185e66
parent4d70a1eb22e8a44c1cecefc62c36f139571de2b5 (diff)
downloadanastasis-d1d097c5bb69230df6d279e4286e7e6a9f0f49f2.tar.gz
anastasis-d1d097c5bb69230df6d279e4286e7e6a9f0f49f2.zip
tests: fix provider selection and syncing
-rwxr-xr-xsrc/cli/test_anastasis_reducer_recovery_enter_user_attributes.sh1
-rwxr-xr-xsrc/cli/test_anastasis_reducer_recovery_no_pay.sh30
2 files changed, 16 insertions, 15 deletions
diff --git a/src/cli/test_anastasis_reducer_recovery_enter_user_attributes.sh b/src/cli/test_anastasis_reducer_recovery_enter_user_attributes.sh
index 4c9c4e9..24cddc3 100755
--- a/src/cli/test_anastasis_reducer_recovery_enter_user_attributes.sh
+++ b/src/cli/test_anastasis_reducer_recovery_enter_user_attributes.sh
@@ -449,7 +449,6 @@ for x in 1 2 3; do
449 cat $R1FILE > $R2FILE 449 cat $R1FILE > $R2FILE
450done 450done
451 451
452CODE=`jq -r -e .code < $R1FILE`
453echo "Providers synced." 452echo "Providers synced."
454 453
455 454
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 ..."