From acc081a2932c9826fceaa77a2c523b27213b6732 Mon Sep 17 00:00:00 2001 From: garethgeorge Date: Mon, 8 Apr 2024 00:32:09 -0700 Subject: [PATCH] chore: fix scheduler wait test --- internal/orchestrator/orchestrator_test.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/internal/orchestrator/orchestrator_test.go b/internal/orchestrator/orchestrator_test.go index 1f58fa8..4b832c2 100644 --- a/internal/orchestrator/orchestrator_test.go +++ b/internal/orchestrator/orchestrator_test.go @@ -153,10 +153,17 @@ func TestSchedulerWait(t *testing.T) { if err != nil { t.Fatalf("failed to create orchestrator: %v", err) } + orch.taskQueue.Reset() + ran := make(chan struct{}) + didRun := false orch.ScheduleTask(&testTask{ 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 }, onRun: func() error {