Skip to content

Commit 756dfd8

Browse files
authored
Test: Wait for the box list to be for the commit round (#6294)
1 parent 558bcc3 commit 756dfd8

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

test/scripts/e2e_subs/box-search.sh

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ ${gcmd} app call --from "$ACCOUNT" --app-id "$APPID" --app-arg "str:set" --app-a
126126
cat "$TEMPDIR/box_create.txn" "$TEMPDIR/box_set.txn" > "$TEMPDIR/box_create_n_set.txn"
127127
${gcmd} clerk group -i "$TEMPDIR/box_create_n_set.txn" -o "$TEMPDIR/box_group.txn"
128128
${gcmd} clerk sign -i "$TEMPDIR/box_group.txn" -o "$TEMPDIR/box_group.stx"
129-
${gcmd} clerk rawsend -f "$TEMPDIR/box_group.stx"
129+
COMMIT=$(${gcmd} clerk rawsend -f "$TEMPDIR/box_group.stx" | grep "committed in round" | head -1 | awk '{print $6}')
130+
echo "Last box made in $COMMIT"
130131

131132
echo "Confirm the NAME is $BOX_NAME"
132133
${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
136137
VALUE=$(${gcmd} app box info --app-id "$APPID" --name "$BOX_NAME" | grep Value | tr -s ' ' | cut -d" " -f2-)
137138
[ "$VALUE" = str:$GREAT_VALUE ]
138139

139-
sleep 15 # again, app box list only hits DB
140140

141-
# Confirm that we can still get the list of boxes
142-
BOX_LIST=$(${gcmd} app box list --app-id "$APPID")
141+
# Confirm that we can still get the list of boxes (need to keep asking
142+
# until the returned results are for $ROUND)
143+
retry=0
144+
while [ $retry -lt 10 ]; do
145+
BOX_LIST=$(${gcmd} app box list --app-id "$APPID")
146+
ROUND=$(echo "$BOX_LIST" | awk '/Round: / {print $2}')
147+
if [[ "$COMMIT" == "$ROUND" ]]; then
148+
break
149+
fi
150+
retry=$((retry + 1))
151+
sleep 2
152+
done
153+
143154
EXPECTED="Boxes:
144155
b64:AQIDBA==
145156
str:base64

0 commit comments

Comments
 (0)