util/eventbus/eventbustest: add support for synctest instead of timers (#17522)
Before synctest, timers was needed to allow the events to flow into the test bus. There is still a timer, but this one is not derived from the test deadline and it is mostly arbitrary as synctest will render it practically non-existent. With this approach, tests that do not need to test for the absence of events do not rely on synctest. Updates #15160 Signed-off-by: Claus Lensbøl <claus@tailscale.com>
This commit is contained in:
@@ -144,7 +144,7 @@ func TestMonitorMode(t *testing.T) {
|
||||
<-done
|
||||
t.Logf("%v callbacks", n)
|
||||
case "eventbus":
|
||||
tw.TimeOut = *monitorDuration
|
||||
time.AfterFunc(*monitorDuration, bus.Close)
|
||||
n := 0
|
||||
mon.Start()
|
||||
eventbustest.Expect(tw, func(event *ChangeDelta) (bool, error) {
|
||||
|
||||
Reference in New Issue
Block a user