Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testing: fix bug in TestAssetGroupCreateSendDestroy #3631

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions test/e2e-go/features/transactions/asset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -632,10 +632,19 @@ func TestAssetGroupCreateSendDestroy(t *testing.T) {
err = client0.BroadcastTransactionGroup(stxns)
a.NoError(err)

_, curRound := fixture.GetBalanceAndRound(account0)
confirmed := fixture.WaitForAllTxnsToConfirm(curRound+5, txids)
status0, err := client0.Status()
a.NoError(err)

confirmed := fixture.WaitForAllTxnsToConfirm(status0.LastRound+5, txids)
a.True(confirmed)

status0, err = client0.Status()
a.NoError(err)

// wait for client1 to reach the same round as client0
_, err = client1.WaitForRound(status0.LastRound)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, I understand that the idea here is that both nodes agree on the block with all the transactions, client0 adds the block in its ledger, returns confirmed on line 638.

However, it could be possible that client1 has not yet added the block and advanced the round, and the client1.AssetInformation(assetID1) fails.

So, by client1.WaitForRound(status0.LastRound) you are making sure that client1 has also added the block before calling client1.AssetInformation(assetID1).

Is this right?

a.NoError(err)

txids = make(map[string]string)

// asset 1 (create + send) exists and available
Expand All @@ -651,10 +660,18 @@ func TestAssetGroupCreateSendDestroy(t *testing.T) {
a.NoError(err)
txids[txid] = account0

_, curRound = fixture.GetBalanceAndRound(account0)
confirmed = fixture.WaitForAllTxnsToConfirm(curRound+5, txids)
status0, err = client0.Status()
a.NoError(err)
confirmed = fixture.WaitForAllTxnsToConfirm(status0.LastRound+5, txids)
a.True(confirmed)

status0, err = client0.Status()
a.NoError(err)

// wait for client1 to reach the same round as client0
_, err = client1.WaitForRound(status0.LastRound)
a.NoError(err)

// asset 3 (create + destroy) not available
_, err = client1.AssetInformation(assetID3)
a.Error(err)
Expand Down