Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AgentApiManifoldTestConfig ¶
func AgentApiManifoldTestConfig() util.AgentApiManifoldConfig
AgentApiManifoldTestConfig returns a AgentApiManifoldConfig suitable for use with RunAgentApiManifold.
func RunAgentApiManifold ¶
func RunAgentApiManifold( manifold dependency.Manifold, agent agent.Agent, apiCaller base.APICaller, ) (worker.Worker, error)
RunAgentApiManifold is useful for testing manifolds based on AgentApiManifold. It takes the manifold, sets up the resources required to successfully pass AgentApiManifold's checks and then runs the manifold start func.
An agent and apiCaller may be optionally provided. If they are nil, dummy barely-good-enough defaults will be used (these dummies are fine not actually used for much).
Types ¶
type StubRunner ¶
type StubRunner struct { worker.Worker // Stub is the underlying testing stub. Stub *testing.Stub // CallWhenStarted indicates that the newWorker func should be // called when StartWorker is called. CallWhenStarted bool }
StubRunner is a testing stub for worker.Runner.
func NewStubRunner ¶
func NewStubRunner(stub *testing.Stub) *StubRunner
NewStubRunner returns a new StubRunner.
func (*StubRunner) CheckCallIDs ¶
func (r *StubRunner) CheckCallIDs(c *gc.C, methName string, expected ...string)
CheckCallIDs verifies that the worker IDs in all calls match the provided ones. If a method name is provided as well then all calls must have that method name.
func (*StubRunner) StartWorker ¶
StartWorker implements worker.Runner.
func (*StubRunner) StopWorker ¶
func (r *StubRunner) StopWorker(id string) error
StopWorker implements worker.Runner.
type StubWorker ¶
StubWorker is a testing stub for worker.Worker.
func NewStubWorker ¶
func NewStubWorker(stub *testing.Stub) *StubWorker
NewStubWorker returns a new StubWorker.