diff options
author | Florian Dold <florian@dold.me> | 2022-04-14 20:57:46 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2022-04-14 20:57:46 +0200 |
commit | d1d097c5bb69230df6d279e4286e7e6a9f0f49f2 (patch) | |
tree | abd75e060353a4353d834e7828cb0cfd53185e66 | |
parent | 4d70a1eb22e8a44c1cecefc62c36f139571de2b5 (diff) | |
download | anastasis-d1d097c5bb69230df6d279e4286e7e6a9f0f49f2.tar.gz anastasis-d1d097c5bb69230df6d279e4286e7e6a9f0f49f2.zip |
tests: fix provider selection and syncing
-rwxr-xr-x | src/cli/test_anastasis_reducer_recovery_enter_user_attributes.sh | 1 | ||||
-rwxr-xr-x | src/cli/test_anastasis_reducer_recovery_no_pay.sh | 30 |
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 |
450 | done | 450 | done |
451 | 451 | ||
452 | CODE=`jq -r -e .code < $R1FILE` | ||
453 | echo "Providers synced." | 452 | echo "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 | |||
218 | echo " OK" | 218 | echo " OK" |
219 | 219 | ||
220 | echo -n "Selecting secret to recover" | 220 | echo -n "Selecting secret to recover" |
221 | anastasis-reducer -a '{"attribute_mask": 0, "providers" : [ { "version": 0, "url" : "http://localhost:8086/" } ] }' select_version < $R1FILE > $R2FILE | 221 | anastasis-reducer -a '{"attribute_mask": 0, "providers" : [ { "version": 1, "url" : "http://localhost:8086/" } ] }' select_version < $R1FILE > $R2FILE |
222 | 222 | ||
223 | STATE=`jq -r -e .recovery_state < $R2FILE` | 223 | STATE=`jq -r -e .recovery_state < $R2FILE` |
224 | if test "$STATE" != "CHALLENGE_SELECTING" | 224 | if test "$STATE" != "CHALLENGE_SELECTING" |
@@ -228,19 +228,21 @@ fi | |||
228 | echo " OK" | 228 | echo " OK" |
229 | 229 | ||
230 | echo -n "Synchronizing providers" | 230 | echo -n "Synchronizing providers" |
231 | anastasis-reducer sync_providers < $R2FILE > $R1FILE | 231 | # Sync with providers (up to 3 providers aren't synced here) |
232 | anastasis-reducer sync_providers < $R1FILE > $R2FILE | 232 | for 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 |
235 | anastasis-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 | |
238 | CODE=`jq -r -e .code < $R1FILE` | 238 | fi |
239 | if test "$CODE" != "8420" | 239 | if test "$CODE" != "0"; then |
240 | then | 240 | exit_fail "Expected no error or 8420, got $CODE" |
241 | exit_fail "Expected to be synced, instead the code is '$CODE'" | 241 | fi |
242 | fi | 242 | cat $R1FILE > $R2FILE |
243 | echo " OK" | 243 | done |
244 | |||
245 | echo "Providers synced." | ||
244 | 246 | ||
245 | 247 | ||
246 | echo -n "Running challenge logic ..." | 248 | echo -n "Running challenge logic ..." |