agenttest

package
v0.0.0-...-8ff1004 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2019 License: AGPL-3.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertManifoldsDependencies

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

AssertManifoldsDependencies asserts that given manifolds have expected dependencies.

func ManifoldDependencies

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

ManifoldDependencies returns all - direct and indirect - manifold dependencies.

func WaitMatch

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.

Types

type AgentSuite

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

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

func (*AgentSuite) AssertCanOpenState

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

func (*AgentSuite) AssertCannotOpenState

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

func (*AgentSuite) InitAgent

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

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

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

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

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

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

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

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

EngineTracker tracks workers which have started.

func NewEngineTracker

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

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

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

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

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

type FakeEnsureMongo

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

func InstallFakeEnsureMongo(suite patchingSuite) *FakeEnsureMongo

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

func (*FakeEnsureMongo) CurrentConfig

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

func (*FakeEnsureMongo) EnsureMongo

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

func (*FakeEnsureMongo) InitiateMongo

func (*FakeEnsureMongo) IsServiceInstalled

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

type WorkerMatcher

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

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

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).

Jump to

Keyboard shortcuts

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