MCPcopy
hub / github.com/robfig/cron / TestRunningMultipleSchedules

Function TestRunningMultipleSchedules

cron_test.go:274–294  ·  cron_test.go::TestRunningMultipleSchedules
(t *testing.T)

Source from the content-addressed store, hash-verified

272}
273
274func TestRunningMultipleSchedules(t *testing.T) {
275 wg := &sync.WaitGroup{}
276 wg.Add(2)
277
278 cron := newWithSeconds()
279 cron.AddFunc("0 0 0 1 1 ?", func() {})
280 cron.AddFunc("0 0 0 31 12 ?", func() {})
281 cron.AddFunc("* * * * * ?", func() { wg.Done() })
282 cron.Schedule(Every(time.Minute), FuncJob(func() {}))
283 cron.Schedule(Every(time.Second), FuncJob(func() { wg.Done() }))
284 cron.Schedule(Every(time.Hour), FuncJob(func() {}))
285
286 cron.Start()
287 defer cron.Stop()
288
289 select {
290 case <-time.After(2 * OneSecond):
291 t.Error("expected job fires 2 times")
292 case <-wait(wg):
293 }
294}
295
296// Test that the cron is run in the local time zone (as opposed to UTC).
297func TestLocalTimezone(t *testing.T) {

Callers

nothing calls this directly

Calls 10

newWithSecondsFunction · 0.85
EveryFunction · 0.85
FuncJobFuncType · 0.85
waitFunction · 0.85
AddFuncMethod · 0.80
DoneMethod · 0.80
ScheduleMethod · 0.80
StartMethod · 0.80
StopMethod · 0.80
ErrorMethod · 0.65

Tested by

no test coverage detected