diff options
Diffstat (limited to 'src/cli/test_anastasis_reducer_recovery_no_pay.sh')
-rwxr-xr-x | src/cli/test_anastasis_reducer_recovery_no_pay.sh | 30 |
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 | |||
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 ..." |