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

Function TestStopCausesJobsToNotRun

cron_test.go:98–113  ·  cron_test.go::TestStopCausesJobsToNotRun

Start, stop, then add an entry. Verify entry doesn't run.

(t *testing.T)

Source from the content-addressed store, hash-verified

96
97// Start, stop, then add an entry. Verify entry doesn't run.
98func TestStopCausesJobsToNotRun(t *testing.T) {
99 wg := &sync.WaitGroup{}
100 wg.Add(1)
101
102 cron := newWithSeconds()
103 cron.Start()
104 cron.Stop()
105 cron.AddFunc("* * * * * ?", func() { wg.Done() })
106
107 select {
108 case <-time.After(OneSecond):
109 // No job ran!
110 case <-wait(wg):
111 t.Fatal("expected stopped cron does not run any job")
112 }
113}
114
115// Add a job, start cron, expect it runs.
116func TestAddBeforeRunning(t *testing.T) {

Callers

nothing calls this directly

Calls 6

newWithSecondsFunction · 0.85
waitFunction · 0.85
StartMethod · 0.80
StopMethod · 0.80
AddFuncMethod · 0.80
DoneMethod · 0.80

Tested by

no test coverage detected