This commit is contained in:
ponzischeme89
2026-08-17 07:34:23 +12:00
parent 93fb0fd728
commit 36cb1324fd
56 changed files with 1177 additions and 168 deletions
@@ -40,6 +40,22 @@ func TestATaskNeedsAnIDAndAFunction(t *testing.T) {
sched.Register(Task{ID: "broken"})
}
func TestQuietTimePausesManualTasks(t *testing.T) {
sched := quietScheduler()
ran := false
sched.Register(Task{ID: "quiet", Name: "Quiet", Run: func(context.Context) (string, error) {
ran = true
return "", nil
}})
sched.SetPaused(func() bool { return true })
if err := sched.RunNow(context.Background(), "quiet"); err == nil {
t.Fatal("manual task started during quiet time")
}
if ran {
t.Fatal("quiet-time task function ran")
}
}
func TestAPanickingTaskBecomesAFailedRun(t *testing.T) {
// A background job is the one place a panic takes the whole process down for a reason
// nobody is watching for. One housekeeping job with a nil map must not be able to stop