MCPcopy
hub / github.com/lxc/incus / TestTask_ScheduleError

Function TestTask_ScheduleError

internal/server/task/task_test.go:53–63  ·  view source on GitHub ↗

If the schedule returns an error, the task is aborted.

(t *testing.T)

Source from the content-addressed store, hash-verified

51
52// If the schedule returns an error, the task is aborted.
53func TestTask_ScheduleError(t *testing.T) {
54 schedule := func() (time.Duration, error) {
55 return 0, errors.New("boom")
56 }
57
58 f, _ := newFunc(t, 0)
59 defer startTask(t, f, schedule)() //nolint:revive
60
61 // Sleep a little bit to prove that the task function does not get run.
62 time.Sleep(100 * time.Millisecond)
63}
64
65// If the schedule returns an error, but its interval is positive, the task will
66// try again to invoke the schedule function after that interval.

Callers

nothing calls this directly

Calls 2

newFuncFunction · 0.85
startTaskFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…