diff --git a/ledger/catchpointtracker_test.go b/ledger/catchpointtracker_test.go index a158d0663f..a55116757c 100644 --- a/ledger/catchpointtracker_test.go +++ b/ledger/catchpointtracker_test.go @@ -1092,16 +1092,19 @@ func TestCatchpointTrackerWaitNotBlocking(t *testing.T) { } // switch context one more time to give the blockqueue syncer to run - time.Sleep(1 * time.Millisecond) + time.Sleep(10 * time.Millisecond) // ensure Ledger.Wait() is non-blocked for all rounds except the last one (due to possible races) for rnd := startRound; rnd < endRound; rnd++ { done := ledger.Wait(rnd) - select { - case <-done: - default: - require.FailNow(t, fmt.Sprintf("Wait(%d) is blocked", rnd)) - } + require.Eventually(t, func() bool { + select { + case <-done: + return true + default: + return false + } + }, 15*time.Millisecond, 1*time.Millisecond, "Wait(%d) is blocked", rnd) } }