agent

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2020 License: Apache-2.0 Imports: 25 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent interface {
	io.Closer
	m3em.OperatorServer

	// Running returns a flag indicating if the test process supervised
	// by the Agent is running.
	Running() bool
}

Agent is the remote executor of m3em operations

func New

func New(
	opts Options,
) (Agent, error)

New creates and returns a new Operator Agent

type ExecGenFn

type ExecGenFn func(buildPath string, configPath string) (execPath string, args []string)

ExecGenFn specifies the command to execute for a given build, and config e.g. say the process binary expects the config with a cli flag "-f", ExecGenFn("binary", "config") == "binary", ["-f", "config"]

type HostResourcesFn

type HostResourcesFn func() error

HostResourcesFn is used by the Agent to capture/release any resources required on the host. E.g. we use hosts that are typically running staging versions of the service being tested, for our integration tests as well. So we use this function hook to stop any running instances of said service on the host.

type Options

type Options interface {
	// Validate checks if the options set are valid
	Validate() error

	// SetInstrumentOptions sets the instrument options
	SetInstrumentOptions(instrument.Options) Options

	// InstrumentOptions returns the instrument options
	InstrumentOptions() instrument.Options

	// SetWorkingDirectory sets the agent's WorkingDirectory
	SetWorkingDirectory(string) Options

	// WorkingDirectory returns the agent's WorkingDirectory
	WorkingDirectory() string

	// SetExecGenFn sets the ExecGenFn
	SetExecGenFn(fn ExecGenFn) Options

	// ExecGenFn returns the ExecGenFn
	ExecGenFn() ExecGenFn

	// SetInitHostResourcesFn sets the InitHostResourcesFn
	SetInitHostResourcesFn(HostResourcesFn) Options

	// InitHostResourcesFn returns the InitHostResourcesFn
	InitHostResourcesFn() HostResourcesFn

	// SetReleaseHostResourcesFn sets the ReleaseHostResourcesFn
	SetReleaseHostResourcesFn(HostResourcesFn) Options

	// ReleaseHostResourcesFn returns the ReleaseHostResourcesFn
	ReleaseHostResourcesFn() HostResourcesFn

	// SetEnvMap sets the EnvMap used to execute any child processes
	SetEnvMap(exec.EnvMap) Options

	// EnvMap returns the EnvMap used to execute any child processes
	EnvMap() exec.EnvMap

	// SetHeartbeatTimeout sets the duration after which failed attempts at
	// sending heartbeats will trigger the agent to reset itself
	SetHeartbeatTimeout(time.Duration) Options

	// HeartbeatTimeout sets the duration after which failed attempts at
	// sending heartbeats will trigger the agent to reset itself
	HeartbeatTimeout() time.Duration

	// SetNowFn sets the now fn
	SetNowFn(xclock.NowFn) Options

	// NowFn returns the now fn
	NowFn() xclock.NowFn

	// SetNewFileMode sets the new file mode
	SetNewFileMode(value os.FileMode) Options

	// NewFileMode returns the new file mode
	NewFileMode() os.FileMode

	// SetNewDirectoryMode sets the new directory mode
	SetNewDirectoryMode(value os.FileMode) Options

	// NewDirectoryMode returns the new directory mode
	NewDirectoryMode() os.FileMode
}

Options represent the knobs for a m3em agent

func NewOptions

func NewOptions(io instrument.Options) Options

NewOptions constructs new options

Jump to

Keyboard shortcuts

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