Test running the same job twice.
(t *testing.T)
| 253 | |
| 254 | // Test running the same job twice. |
| 255 | func TestRunningJobTwice(t *testing.T) { |
| 256 | wg := &sync.WaitGroup{} |
| 257 | wg.Add(2) |
| 258 | |
| 259 | cron := newWithSeconds() |
| 260 | cron.AddFunc("0 0 0 1 1 ?", func() {}) |
| 261 | cron.AddFunc("0 0 0 31 12 ?", func() {}) |
| 262 | cron.AddFunc("* * * * * ?", func() { wg.Done() }) |
| 263 | |
| 264 | cron.Start() |
| 265 | defer cron.Stop() |
| 266 | |
| 267 | select { |
| 268 | case <-time.After(2 * OneSecond): |
| 269 | t.Error("expected job fires 2 times") |
| 270 | case <-wait(wg): |
| 271 | } |
| 272 | } |
| 273 | |
| 274 | func TestRunningMultipleSchedules(t *testing.T) { |
| 275 | wg := &sync.WaitGroup{} |