chore: fix scheduler wait test

This commit is contained in:
garethgeorge
2024-04-08 00:32:09 -07:00
parent 4b2763cdbb
commit acc081a293

View File

@@ -153,10 +153,17 @@ func TestSchedulerWait(t *testing.T) {
if err != nil { if err != nil {
t.Fatalf("failed to create orchestrator: %v", err) t.Fatalf("failed to create orchestrator: %v", err)
} }
orch.taskQueue.Reset()
ran := make(chan struct{}) ran := make(chan struct{})
didRun := false
orch.ScheduleTask(&testTask{ orch.ScheduleTask(&testTask{
onNext: func(t time.Time) *time.Time { onNext: func(t time.Time) *time.Time {
t = t.Add(150 * time.Millisecond) if didRun {
return nil
}
t = t.Add(100 * time.Millisecond)
didRun = true
return &t return &t
}, },
onRun: func() error { onRun: func() error {