Skip to content

Commit

Permalink
update TestCatchpointFastUpdates to give one more kick if DB commits …
Browse files Browse the repository at this point in the history
…fall behind
  • Loading branch information
cce committed Dec 19, 2024
1 parent 48d76af commit 8adddbc
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions ledger/catchpointtracker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1882,10 +1882,6 @@ func TestHashContract(t *testing.T) {
func TestCatchpointFastUpdates(t *testing.T) {
partitiontest.PartitionTest(t)

if runtime.GOARCH == "arm" || runtime.GOARCH == "arm64" {
t.Skip("This test is too slow on ARM and causes CI builds to time out")
}

proto := config.Consensus[protocol.ConsensusFuture]

accts := []map[basics.Address]basics.AccountData{ledgertesting.RandomAccounts(20, true)}
Expand Down Expand Up @@ -1925,6 +1921,7 @@ func TestCatchpointFastUpdates(t *testing.T) {

wg := sync.WaitGroup{}

lastRound := basics.Round(0)
for i := basics.Round(initialBlocksCount); i < basics.Round(proto.CatchpointLookback+15); i++ {
rewardLevelDelta := crypto.RandUint64() % 5
rewardLevel += rewardLevelDelta
Expand Down Expand Up @@ -1959,10 +1956,21 @@ func TestCatchpointFastUpdates(t *testing.T) {
defer wg.Done()
ml.trackers.committedUpTo(round)
}(i)
lastRound = i
}
wg.Wait()
ml.trackers.waitAccountsWriting()

if ml.trackers.getDbRound() <= basics.Round(proto.CatchpointLookback) {
// db round stuck <= 320? likely committedUpTo dropped some commit tasks, due to deferredCommits channel full
// so give it another try
ml.trackers.committedUpTo(lastRound)
require.Eventually(t, func() bool {
//ml.trackers.waitAccountsWriting()
return ml.trackers.getDbRound() > basics.Round(proto.CatchpointLookback)
}, 5*time.Second, 100*time.Millisecond)
}

require.NotEmpty(t, ct.GetLastCatchpointLabel())
}

Expand Down

0 comments on commit 8adddbc

Please sign in to comment.