Skip to content

Commit c2054e5

Browse files
authored
Increase wait time for the transaction to be included. (#3098)
## Summary This change wait for a given broadcasted transaction to be included instead of expecting it to be included after a predetermined number of rounds. This would increase the testing platform flexibility in case we're testing on slow machines. ## Test Plan This is a test.
1 parent 1e5603c commit c2054e5

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

test/e2e-go/features/transactions/accountv2_test.go

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func TestAccountInformationV2(t *testing.T) {
8989
proto.AgreementFilterTimeout = 400 * time.Millisecond
9090
fixture.SetConsensus(config.ConsensusProtocols{protocol.ConsensusFuture: proto})
9191

92-
fixture.Setup(t, filepath.Join("nettemplates", "TwoNodes50EachFuture.json"))
92+
fixture.Setup(t, filepath.Join("nettemplates", "TwoNodes50EachV26.json"))
9393
defer fixture.Shutdown()
9494

9595
client := fixture.LibGoalClient
@@ -105,13 +105,15 @@ func TestAccountInformationV2(t *testing.T) {
105105

106106
fee := uint64(1000)
107107

108+
var txn transactions.Transaction
109+
108110
// Fund the manager, so it can issue transactions later on
109-
_, err = client.SendPaymentFromUnencryptedWallet(creator, user, fee, 10000000000, nil)
111+
txn, err = client.SendPaymentFromUnencryptedWallet(creator, user, fee, 10000000000, nil)
110112
a.NoError(err)
111113

112114
round, err := client.CurrentRound()
113115
a.NoError(err)
114-
client.WaitForRound(round + 4)
116+
fixture.WaitForConfirmedTxn(round+4, creator, txn.ID().String())
115117

116118
// There should be no apps to start with
117119
ad, err := client.AccountData(creator)
@@ -285,16 +287,23 @@ int 1
285287
a.NoError(err)
286288
signedTxn, err = client.SignTransactionWithWallet(wh, nil, tx)
287289
a.NoError(err)
288-
_, err = client.BroadcastTransaction(signedTxn)
289-
a.NoError(err)
290-
round, err = client.CurrentRound()
291-
a.NoError(err)
292-
_, err = client.WaitForRound(round + 2)
293-
a.NoError(err)
294-
// Ensure the txn committed
295-
resp, err = client.GetPendingTransactions(2)
290+
txid, err = client.BroadcastTransaction(signedTxn)
296291
a.NoError(err)
297-
a.Equal(uint64(0), resp.TotalTxns)
292+
for {
293+
round, err = client.CurrentRound()
294+
a.NoError(err)
295+
_, err = client.WaitForRound(round + 1)
296+
a.NoError(err)
297+
// Ensure the txn committed
298+
resp, err = client.GetPendingTransactions(2)
299+
a.NoError(err)
300+
if resp.TotalTxns == 1 {
301+
a.Equal(resp.TruncatedTxns.Transactions[0].TxID, txid)
302+
continue
303+
}
304+
a.Equal(uint64(0), resp.TotalTxns)
305+
break
306+
}
298307

299308
ad, err = client.AccountData(creator)
300309
a.NoError(err)

0 commit comments

Comments
 (0)