agenttest

package
v0.0.0-...-b9bb202 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: AGPL-3.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WaitMatch

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

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

Types

type AgentSuite

type AgentSuite struct {
	testing.ApiServerSuite

	Environ environs.Environ
	DataDir string
	LogDir  string
}

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

func (s *AgentSuite) SetUpTest(c *gc.C)

func (*AgentSuite) WriteStateAgentConfig

func (s *AgentSuite) WriteStateAgentConfig(
	c *gc.C,
	tag names.Tag,
	password string,
	vers version.Binary,
	modelTag names.ModelTag,
	apiPort int,
) 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 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