From 3572e1f9ac438af26859253074765347ab2aad4b Mon Sep 17 00:00:00 2001 From: Tsachi Herman Date: Wed, 13 Oct 2021 15:32:46 -0400 Subject: [PATCH] Reorder round query and transaction sending. (#3049) ## Summary The test had a conceptual buggy pattern. It was using ```golang round, err = client.CurrentRound() ... _, err = client.BroadcastTransaction(signedTxn) ... _, err = client.WaitForRound(round + 3) ``` which is doomed to fail if the test process goes to sleep for a minute between the `client.CurrentRound()` call and the `client.BroadcastTransaction` call. The trivial solution is to reorder the calls so that ```golang _, err = client.BroadcastTransaction(signedTxn) ... round, err = client.CurrentRound() ... _, err = client.WaitForRound(round + 3) ``` ## Test Plan This is a test. --- .../features/transactions/accountv2_test.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/test/e2e-go/features/transactions/accountv2_test.go b/test/e2e-go/features/transactions/accountv2_test.go index b5cd81afb6..f8902df3bf 100644 --- a/test/e2e-go/features/transactions/accountv2_test.go +++ b/test/e2e-go/features/transactions/accountv2_test.go @@ -105,12 +105,12 @@ func TestAccountInformationV2(t *testing.T) { fee := uint64(1000) - round, err := client.CurrentRound() - a.NoError(err) - // Fund the manager, so it can issue transactions later on _, err = client.SendPaymentFromUnencryptedWallet(creator, user, fee, 10000000000, nil) a.NoError(err) + + round, err := client.CurrentRound() + a.NoError(err) client.WaitForRound(round + 4) // There should be no apps to start with @@ -165,10 +165,10 @@ int 1 a.NoError(err) signedTxn, err := client.SignTransactionWithWallet(wh, nil, tx) a.NoError(err) - round, err = client.CurrentRound() - a.NoError(err) txid, err := client.BroadcastTransaction(signedTxn) a.NoError(err) + round, err = client.CurrentRound() + a.NoError(err) // ensure transaction is accepted into a block within 5 rounds. confirmed := fixture.WaitForAllTxnsToConfirm(round+5, map[string]string{txid: signedTxn.Txn.Sender.String()}) a.True(confirmed) @@ -214,10 +214,10 @@ int 1 a.NoError(err) signedTxn, err = client.SignTransactionWithWallet(wh, nil, tx) a.NoError(err) - round, err = client.CurrentRound() - a.NoError(err) txid, err = client.BroadcastTransaction(signedTxn) a.NoError(err) + round, err = client.CurrentRound() + a.NoError(err) _, err = client.WaitForRound(round + 3) a.NoError(err) // Ensure the txn committed @@ -285,10 +285,10 @@ int 1 a.NoError(err) signedTxn, err = client.SignTransactionWithWallet(wh, nil, tx) a.NoError(err) - round, err = client.CurrentRound() - a.NoError(err) _, err = client.BroadcastTransaction(signedTxn) a.NoError(err) + round, err = client.CurrentRound() + a.NoError(err) _, err = client.WaitForRound(round + 2) a.NoError(err) // Ensure the txn committed