From 5b8761ebc927fa0fbeeb961124b0987f962be1e7 Mon Sep 17 00:00:00 2001 From: ptrus Date: Fri, 18 Sep 2020 09:57:49 +0200 Subject: [PATCH] go/consensus/tests: Use same height when comparing query results --- .changelog/3287.internal.md | 4 ++++ go/consensus/tests/tester.go | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 .changelog/3287.internal.md diff --git a/.changelog/3287.internal.md b/.changelog/3287.internal.md new file mode 100644 index 00000000000..5e0536c2897 --- /dev/null +++ b/.changelog/3287.internal.md @@ -0,0 +1,4 @@ +go/consensus/tests: Use explicit latest height when comparing query results + +Fixes flakiness in the test that occurred when a different height was used +for the `GetTransactions` and `GetTransactionsWithResults` queries. diff --git a/go/consensus/tests/tester.go b/go/consensus/tests/tester.go index 03e760840e8..340e72dd19e 100644 --- a/go/consensus/tests/tester.go +++ b/go/consensus/tests/tester.go @@ -53,10 +53,10 @@ func ConsensusImplementationTests(t *testing.T, backend consensus.ClientBackend) require.EqualValues(blk.Hash, status.LatestHash, "latest block hashes should match") require.EqualValues(blk.StateRoot, status.LatestStateRoot, "latest state roots should match") - txs, err := backend.GetTransactions(ctx, consensus.HeightLatest) + txs, err := backend.GetTransactions(ctx, status.LatestHeight) require.NoError(err, "GetTransactions") - txsWithResults, err := backend.GetTransactionsWithResults(ctx, consensus.HeightLatest) + txsWithResults, err := backend.GetTransactionsWithResults(ctx, status.LatestHeight) require.NoError(err, "GetTransactionsWithResults") require.Len( txsWithResults.Transactions,