| 272 | } |
| 273 | |
| 274 | func 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). |
| 297 | func TestLocalTimezone(t *testing.T) { |