batches/scheduler: remove flaky assertions
Created by: LawnGnome
As identified by @rvantonder in #22445, two specific assertions in ticker_test.go
could result in test failures. Although ticker.stop()
closes ticker.done
, just draining that channel doesn't mean that ticker.C
has been closed, as that happens asynchronously.
We could make ticker.stop()
block until ticker.C
is closed, but I don't think that's necessary or useful here: if the ticker's core goroutine is blocked waiting to send to another channel, this might take a while or — worse — cause a deadlock. ticker.stop()
having lazy, asynchronous cleanup semantics seems reasonable to me.
(I did audit the other uses of stop()
, but while there's a similar test construction in TestTickerZero
, I don't believe it suffers from this problem, as there's no specific timing expected for ticker.C
being closed.)