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

Function TestRemoveWhileRunning

cron_test.go:185–200  ·  cron_test.go::TestRemoveWhileRunning

Start cron, add a job, remove it, expect it doesn't run.

(t *testing.T)

Source from the content-addressed store, hash-verified

183
184// Start cron, add a job, remove it, expect it doesn't run.
185func TestRemoveWhileRunning(t *testing.T) {
186 wg := &sync.WaitGroup{}
187 wg.Add(1)
188
189 cron := newWithSeconds()
190 cron.Start()
191 defer cron.Stop()
192 id, _ := cron.AddFunc("* * * * * ?", func() { wg.Done() })
193 cron.Remove(id)
194
195 select {
196 case <-time.After(OneSecond):
197 case <-wait(wg):
198 t.FailNow()
199 }
200}
201
202// Test timing with Entries.
203func TestSnapshotEntries(t *testing.T) {

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected