juju: github.com/juju/juju/cmd/jujud/agent/agenttest Index | Files

package agenttest

import "github.com/juju/juju/cmd/jujud/agent/agenttest"

Index

Package Files

agent.go engine.go

func AssertManifoldsDependencies Uses

func AssertManifoldsDependencies(c *gc.C, manifolds dependency.Manifolds, expected map[string][]string)

AssertManifoldsDependencies asserts that given manifolds have expected dependencies.

func ManifoldDependencies Uses

func ManifoldDependencies(all dependency.Manifolds, name string, manifold dependency.Manifold) set.Strings

ManifoldDependencies returns all - direct and indirect - manifold dependencies.

func WaitMatch Uses

func WaitMatch(c *gc.C, match func() bool, maxWait time.Duration, sync func())

WaitMatch returns only when the match func succeeds, or it times out.

type AgentSuite Uses

type AgentSuite struct {
    testing.JujuConnSuite
    // contains filtered or unexported fields
}

agentSuite is a fixture to be used by agent test suites.

func (*AgentSuite) AssertCanOpenState Uses

func (s *AgentSuite) AssertCanOpenState(c *gc.C, tag names.Tag, dataDir string)

func (*AgentSuite) AssertCannotOpenState Uses

func (s *AgentSuite) AssertCannotOpenState(c *gc.C, tag names.Tag, dataDir string)

func (*AgentSuite) InitAgent Uses

func (s *AgentSuite) InitAgent(c *gc.C, a cmd.Command, args ...string)

InitAgent initialises the given agent command with additional arguments as provided.

func (*AgentSuite) PrimeAgent Uses

func (s *AgentSuite) PrimeAgent(c *gc.C, tag names.Tag, password string) (agent.ConfigSetterWriter, *coretools.Tools)

PrimeAgent writes the configuration file and tools for an agent with the given entity name. It returns the agent's configuration and the current tools.

func (*AgentSuite) PrimeAgentVersion Uses

func (s *AgentSuite) PrimeAgentVersion(c *gc.C, tag names.Tag, password string, vers version.Binary) (agent.ConfigSetterWriter, *coretools.Tools)

PrimeAgentVersion writes the configuration file and tools with version vers for an agent with the given entity name. It returns the agent's configuration and the current tools.

func (*AgentSuite) PrimeStateAgent Uses

func (s *AgentSuite) PrimeStateAgent(c *gc.C, tag names.Tag, password string) (agent.ConfigSetterWriter, *coretools.Tools)

PrimeStateAgent writes the configuration file and tools for a state agent with the given entity name. It returns the agent's configuration and the current tools.

func (*AgentSuite) PrimeStateAgentVersion Uses

func (s *AgentSuite) PrimeStateAgentVersion(c *gc.C, tag names.Tag, password string, vers version.Binary) (
    agent.ConfigSetterWriter, *coretools.Tools,
)

PrimeStateAgentVersion writes the configuration file and tools with version vers for a state agent with the given entity name. It returns the agent's configuration and the current tools.

func (*AgentSuite) SetControllerConfigAPIPort Uses

func (s *AgentSuite) SetControllerConfigAPIPort(c *gc.C, apiPort int)

SetControllerConfigAPIPort resets the API port in controller config to the value provided - this is useful in tests that create multiple agents and only start one, so that the API port the http server listens on matches the one the agent tries to connect to.

func (*AgentSuite) WriteStateAgentConfig Uses

func (s *AgentSuite) WriteStateAgentConfig(
    c *gc.C,
    tag names.Tag,
    password string,
    vers version.Binary,
    modelTag names.ModelTag,
) agent.ConfigSetterWriter

WriteStateAgentConfig creates and writes a state agent config.

type EngineTracker Uses

type EngineTracker struct {
    // contains filtered or unexported fields
}

EngineTracker tracks workers which have started.

func NewEngineTracker Uses

func NewEngineTracker() *EngineTracker

NewEngineTracker creates a type that can Install itself into a Manifolds map, and expose recent snapshots of running Workers.

func (*EngineTracker) Install Uses

func (tracker *EngineTracker) Install(raw dependency.Manifolds, id string) error

Install injects a manifold named TEST-TRACKER into raw, which will depend on all other manifolds in raw and write currently-available worker information to the tracker (differentiating it from other tracked engines via the id param).

func (*EngineTracker) Report Uses

func (tracker *EngineTracker) Report(id string) map[string]interface{}

Report returns the most-recently-reported self-report. It will only work if you hack up the relevant engine-starting code to include:

manifolds["self"] = dependency.SelfManifold(engine)

or otherwise inject a suitable "self" manifold.

func (*EngineTracker) Workers Uses

func (tracker *EngineTracker) Workers(id string) set.Strings

Workers returns the most-recently-reported set of running workers.

type FakeEnsureMongo Uses

type FakeEnsureMongo struct {
    EnsureCount      int
    InitiateCount    int
    DataDir          string
    OplogSize        int
    Info             state.StateServingInfo
    InitiateParams   peergrouper.InitiateMongoParams
    Err              error
    ServiceInstalled bool
}

FakeEnsureMongo provides test fakes for the functions used to initialise MongoDB.

func InstallFakeEnsureMongo Uses

func InstallFakeEnsureMongo(suite patchingSuite) *FakeEnsureMongo

InstallFakeEnsureMongo creates a new FakeEnsureMongo, patching out replicaset.CurrentConfig and cmdutil.EnsureMongoServer.

func (*FakeEnsureMongo) CurrentConfig Uses

func (f *FakeEnsureMongo) CurrentConfig(*mgo.Session) (*replicaset.Config, error)

func (*FakeEnsureMongo) EnsureMongo Uses

func (f *FakeEnsureMongo) EnsureMongo(args mongo.EnsureServerParams) (mongo.Version, error)

func (*FakeEnsureMongo) InitiateMongo Uses

func (f *FakeEnsureMongo) InitiateMongo(p peergrouper.InitiateMongoParams) error

func (*FakeEnsureMongo) IsServiceInstalled Uses

func (f *FakeEnsureMongo) IsServiceInstalled() (bool, error)

type WorkerMatcher Uses

type WorkerMatcher struct {
    // contains filtered or unexported fields
}

WorkerMatcher monitors the workers of a single engine manager, using an EngineTracker, for a given set of workers to be running.

func NewWorkerMatcher Uses

func NewWorkerMatcher(c *gc.C, tracker *EngineTracker, id string, workers []string) *WorkerMatcher

NewWorkerMatcher takes an EngineTracker, an engine manager id to monitor and the workers that are expected to be running and sets up a WorkerMatcher.

func (*WorkerMatcher) Check Uses

func (m *WorkerMatcher) Check() bool

Check returns true if the workers which are expected to be running (as specified in the call to NewWorkerMatcher) are running and have been running for a short period (i.e. some indication of stability).

Package agenttest imports 38 packages (graph). Updated 2019-10-13. Refresh now. Tools for package owners.