diff --git a/test/scripts/e2e_subs/box-search.sh b/test/scripts/e2e_subs/box-search.sh index 5f451b03ea..543ce47a87 100755 --- a/test/scripts/e2e_subs/box-search.sh +++ b/test/scripts/e2e_subs/box-search.sh @@ -126,7 +126,8 @@ ${gcmd} app call --from "$ACCOUNT" --app-id "$APPID" --app-arg "str:set" --app-a cat "$TEMPDIR/box_create.txn" "$TEMPDIR/box_set.txn" > "$TEMPDIR/box_create_n_set.txn" ${gcmd} clerk group -i "$TEMPDIR/box_create_n_set.txn" -o "$TEMPDIR/box_group.txn" ${gcmd} clerk sign -i "$TEMPDIR/box_group.txn" -o "$TEMPDIR/box_group.stx" -${gcmd} clerk rawsend -f "$TEMPDIR/box_group.stx" +COMMIT=$(${gcmd} clerk rawsend -f "$TEMPDIR/box_group.stx" | grep "committed in round" | head -1 | awk '{print $6}') +echo "Last box made in $COMMIT" echo "Confirm the NAME is $BOX_NAME" ${gcmd} app box info --app-id "$APPID" --name "$BOX_NAME" @@ -136,10 +137,20 @@ NAME=$(${gcmd} app box info --app-id "$APPID" --name "$BOX_NAME" | grep Name | t VALUE=$(${gcmd} app box info --app-id "$APPID" --name "$BOX_NAME" | grep Value | tr -s ' ' | cut -d" " -f2-) [ "$VALUE" = str:$GREAT_VALUE ] -sleep 15 # again, app box list only hits DB -# Confirm that we can still get the list of boxes -BOX_LIST=$(${gcmd} app box list --app-id "$APPID") +# Confirm that we can still get the list of boxes (need to keep asking +# until the returned results are for $ROUND) +retry=0 +while [ $retry -lt 10 ]; do + BOX_LIST=$(${gcmd} app box list --app-id "$APPID") + ROUND=$(echo "$BOX_LIST" | awk '/Round: / {print $2}') + if [[ "$COMMIT" == "$ROUND" ]]; then + break + fi + retry=$((retry + 1)) + sleep 2 +done + EXPECTED="Boxes: b64:AQIDBA== str:base64