Skip to content

Fix adaptive calculator flaky tests

For #5473 (closed)

In this test, we let the calculator run with a real timer. The test waits for a fixed amount of time before asserting the results. On CI or environments with fewer resources, the timer may have some additional delay. Increasing the waiting time may reduce the odds, but doesn't solve the problem permanently.

This MR lets the test polls for a certain amount of events before asserting. This approach makes the tests independent from the timer.


For #5467 (closed)

This test was flaky because the calibration goroutine started later than expected. When Start() function exits, the test starts to tick the manual timer. If the calibration goroutine starts too late, the calibration may miss one tick. Hence, this MR converts the test to use CountTicker, which allows a callback after the timer is reset for N times. It also adds a simple synchronization channel to ensure Start() returns when the calibration goroutine already starts.

Merge request reports