58
63
// exists primarily to be patched out via NewManifoldWorker for ease of testing,
59
64
// and is not itself directly tested. It would almost certainly be better to
60
65
// pass the constructor dependencies in as explicit manifold config.
61
var NewManifoldWorker = func(agent agent.Agent, apiCaller base.APICaller, guarantee time.Duration) (worker.Worker, error) {
66
var NewManifoldWorker = func(agent agent.Agent, apiCaller base.APICaller, clock clock.Clock, guarantee time.Duration) (worker.Worker, error) {
62
67
tag := agent.CurrentConfig().Tag()
63
68
unitTag, ok := tag.(names.UnitTag)
65
70
return nil, fmt.Errorf("expected a unit tag; got %q", tag)
67
72
claimer := leadership.NewClient(apiCaller)
68
return NewTracker(unitTag, claimer, guarantee), nil
73
return NewTracker(unitTag, claimer, clock, guarantee), nil
71
76
// outputFunc extracts the coreleadership.Tracker from a *Tracker passed in as a Worker.