mirror of
https://github.com/garethgeorge/backrest.git
synced 2025-12-12 16:55:39 +00:00
chore: fix scheduler wait test
This commit is contained in:
@@ -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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user