testing

package
v0.0.0-...-2608902 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2016 License: AGPL-3.0 Imports: 12 Imported by: 0

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

func (r *StubRunner) StartWorker(id string, newWorker func() (worker.Worker, error)) error

StartWorker implements worker.Runner.

func (*StubRunner) StopWorker

func (r *StubRunner) StopWorker(id string) error

StopWorker implements worker.Runner.

type StubWorker

type StubWorker struct {
	// Stub is the underlying testing stub.
	Stub *testing.Stub
}

StubWorker is a testing stub for worker.Worker.

func NewStubWorker

func NewStubWorker(stub *testing.Stub) *StubWorker

NewStubWorker returns a new StubWorker.

func (*StubWorker) Kill

func (w *StubWorker) Kill()

Kill implements worker.Worker.

func (*StubWorker) Wait

func (w *StubWorker) Wait() error

Wait implements worker.Worker.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL