0.2.71
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user