execagent

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2019 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// BaseDir is where tests will store state and can be overridden by
	// setting NOMAD_TEST_DIR. Defaults to "/opt/nomadtest"
	BaseDir = "/opt/nomadtest"
)

Functions

func NewClientServerPair

func NewClientServerPair(bin string, serverOut, clientOut io.Writer) (
	server *NomadAgent, client *NomadAgent, err error)

NewClientServerPair creates a pair of Nomad agents: 1 server, 1 client.

Types

type AgentMode

type AgentMode int
const (
	// Conf enum is for configuring either a client, server, or mixed agent.
	ModeClient AgentMode = 1
	ModeServer AgentMode = 2
	ModeBoth             = ModeClient | ModeServer
)

type AgentTemplateVars

type AgentTemplateVars struct {
	HTTP         int
	RPC          int
	Serf         int
	EnableClient bool
	EnableServer bool
	LogLevel     string
}

type NomadAgent

type NomadAgent struct {
	// BinPath is the path to the Nomad binary
	BinPath string

	// DataDir is the path state will be saved in
	DataDir string

	// ConfFile is the path to the agent's conf file
	ConfFile string

	// Cmd is the agent process
	Cmd *exec.Cmd

	// Vars are the config parameters used to template
	Vars *AgentTemplateVars
}

NomadAgent manages an external Nomad agent process.

func NewMixedAgent

func NewMixedAgent(bin string) (*NomadAgent, error)

NewMixedAgent creates a new Nomad agent in mixed server+client mode but does not start the agent process until the Start() method is called.

func (*NomadAgent) Client

func (n *NomadAgent) Client() (*api.Client, error)

Client returns an api.Client for the agent.

func (*NomadAgent) Destroy

func (n *NomadAgent) Destroy() error

Destroy stops the agent and removes the data dir.

func (*NomadAgent) Start

func (n *NomadAgent) Start() error

Start the agent command.

func (*NomadAgent) Stop

func (n *NomadAgent) Stop() error

Stop sends an interrupt signal and returns the command's Wait error.

Jump to

Keyboard shortcuts

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