Skip to content

Commit

Permalink
range check the round
Browse files Browse the repository at this point in the history
  • Loading branch information
bbroder-algo committed Apr 27, 2023
1 parent a6edd40 commit 50aa861
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion test/e2e-go/restAPI/restClient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1523,16 +1523,23 @@ end:
{encodeInt(12321), "int:12321", []byte{0, 1, 254, 3, 2}, 21},
{[]byte{0, 248, 255, 32}, "b64:APj/IA==", []byte("lux56"), 22},
}

for _, boxTest := range boxTests {
// Box values are 5 bytes, as defined by the test TEAL program.
operateBoxAndSendTxn("create", []string{string(boxTest.name)}, []string{""})
operateBoxAndSendTxn("set", []string{string(boxTest.name)}, []string{string(boxTest.value)})

currentRoundBeforeBoxes, err := testClient.CurrentRound()
a.NoError(err)
boxResponse, err := testClient.GetApplicationBoxByName(uint64(createdAppID), boxTest.encodedName)
a.NoError(err)
currentRoundAfterBoxes, err := testClient.CurrentRound()
a.NoError(err)
a.Equal(boxTest.name, boxResponse.Name)
a.Equal(boxTest.value, boxResponse.Value)
a.Equal(boxTest.round, boxResponse.Round)
// To reduce flakiness, only check the round from simulate is within a range.
a.GreaterOrEqual(result.LastRound, currentRoundBeforeBoxes)
a.LessOrEqual(result.LastRound, currentAfterAfterBoxes)
}

const numberOfBoxesRemaining = uint64(3)
Expand Down

0 comments on commit 50aa861

Please sign in to comment.