Skip to content

Commit e10cc09

Browse files
authored
test: fix flaky TestExactAccountChunk again (#6278)
1 parent 272ec02 commit e10cc09

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

ledger/catchpointfilewriter_test.go

+7-4
Original file line numberDiff line numberDiff line change
@@ -905,11 +905,10 @@ func testExactAccountChunk(t *testing.T, proto protocol.ConsensusVersion, extraB
905905
dl.fullBlock(&selfpay)
906906
}
907907

908-
genR, _ := testCatchpointFlushRound(dl.generator)
909-
valR, _ := testCatchpointFlushRound(dl.validator)
910-
require.Equal(t, genR, valR)
911-
require.EqualValues(t, BalancesPerCatchpointFileChunk-12+extraBlocks, genR)
908+
testCatchpointFlushRound(dl.generator)
909+
testCatchpointFlushRound(dl.validator)
912910

911+
// wait for the two ledgers to finish committing and be in sync
913912
require.Eventually(t, func() bool {
914913
dl.generator.accts.accountsMu.RLock()
915914
dlg := len(dl.generator.accts.deltas)
@@ -920,6 +919,10 @@ func testExactAccountChunk(t *testing.T, proto protocol.ConsensusVersion, extraB
920919
dl.validator.accts.accountsMu.RUnlock()
921920
return dlg == dlv && dl.generator.Latest() == dl.validator.Latest()
922921
}, 10*time.Second, 100*time.Millisecond)
922+
genR, _ := dl.generator.LatestCommitted()
923+
valR, _ := dl.validator.LatestCommitted()
924+
require.Equal(t, genR, valR)
925+
require.EqualValues(t, BalancesPerCatchpointFileChunk-12+extraBlocks, genR)
923926

924927
tempDir := t.TempDir()
925928

0 commit comments

Comments
 (0)