Skip to content

Commit 917c50a

Browse files
authored
tests: add retries to TestCatchpointTrackerWaitNotBlocking (#6472)
1 parent 1625da7 commit 917c50a

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

ledger/catchpointtracker_test.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,16 +1092,19 @@ func TestCatchpointTrackerWaitNotBlocking(t *testing.T) {
10921092
}
10931093

10941094
// switch context one more time to give the blockqueue syncer to run
1095-
time.Sleep(1 * time.Millisecond)
1095+
time.Sleep(10 * time.Millisecond)
10961096

10971097
// ensure Ledger.Wait() is non-blocked for all rounds except the last one (due to possible races)
10981098
for rnd := startRound; rnd < endRound; rnd++ {
10991099
done := ledger.Wait(rnd)
1100-
select {
1101-
case <-done:
1102-
default:
1103-
require.FailNow(t, fmt.Sprintf("Wait(%d) is blocked", rnd))
1104-
}
1100+
require.Eventually(t, func() bool {
1101+
select {
1102+
case <-done:
1103+
return true
1104+
default:
1105+
return false
1106+
}
1107+
}, 15*time.Millisecond, 1*time.Millisecond, "Wait(%d) is blocked", rnd)
11051108
}
11061109
}
11071110

0 commit comments

Comments
 (0)