Documentation ¶
Index ¶
- Constants
- func BinaryPath() (string, error)
- func ParsePort(input string) (int, error)
- type Cluster
- func (obj *Cluster) Close() error
- func (obj *Cluster) DeployLang(code string) error
- func (obj *Cluster) Dir() string
- func (obj *Cluster) Init() error
- func (obj *Cluster) Instances() map[string]*Instance
- func (obj *Cluster) Kill() error
- func (obj *Cluster) Quit(ctx context.Context) error
- func (obj *Cluster) RunLinear() error
- func (obj *Cluster) SimpleDeployLang(code string) error
- func (obj *Cluster) Wait(ctx context.Context) error
- type Instance
- func (obj *Instance) Close() error
- func (obj *Instance) CombinedOutput() (string, error)
- func (obj *Instance) DeployLang(code string) error
- func (obj *Instance) Dir() string
- func (obj *Instance) Init() error
- func (obj *Instance) Kill() error
- func (obj *Instance) Quit(ctx context.Context) error
- func (obj *Instance) Run(seeds []*Instance) error
- func (obj *Instance) SimpleDeployLang(code string) error
- func (obj *Instance) Wait(ctx context.Context) error
Constants ¶
const ( // RootDirectory is the directory that is exposed in the per instance // directory which can be used by that instance safely. RootDirectory = "root" // PrefixDirectory is the directory that is exposed in the per instance // directory which is used for the mgmt prefix. PrefixDirectory = "prefix" // ConvergedStatusFile is the name of the file which is used for the // converged status tracking. ConvergedStatusFile = "csf.txt" // StdoutStderrFile is the name of the file which is used for the // command output. StdoutStderrFile = "stdoutstderr.txt" )
Variables ¶
This section is empty.
Functions ¶
func BinaryPath ¶
BinaryPath returns the full path to an mgmt binary. It expects that someone will run `make build` or something equivalent to produce a binary before this function runs.
Types ¶
type Cluster ¶
type Cluster struct { // Etcd specifies if we should run a standalone etcd instance instead of // using the automatic, built-in etcd clustering. Etcd bool // Hostnames is the list of unique identifiers for this cluster. Hostnames []string // Preserve prevents the runtime output from being explicitly deleted. // This is helpful for running analysis or tests on the output. Preserve bool // Logf is a logger which should be used. Logf func(format string, v ...interface{}) // Debug enables more verbosity. Debug bool // contains filtered or unexported fields }
Cluster represents an mgmt cluster. It uses the instance building blocks to run clustered tests.
func (*Cluster) DeployLang ¶
DeployLang deploys some code to the cluster. It arbitrarily picks the first host to run the deploy on unless there is an etcd server running.
func (*Cluster) Dir ¶
Dir returns the dir where the instance can write to. You should only use this after Init has been called, or it won't have been created and determined yet.
func (*Cluster) Init ¶
Init runs some initialization for this Cluster. It errors if the struct was populated in an invalid way, or if it can't initialize correctly.
func (*Cluster) Instances ¶
Instances returns the map of instances attached to this cluster. It is most useful after a cluster has started. Before Init, it won't have any entries.
func (*Cluster) Quit ¶
Quit sends a friendly shutdown request to the cluster. You can specify a context if you'd like to exit earlier. If you trigger an early exit with the context, then this will end up running a `kill -9` so it can return. Remember to leave a longer timeout when using a context since this will have to call quit on each member individually.
func (*Cluster) SimpleDeployLang ¶
SimpleDeployLang is a helper method that takes a struct representing a cluster and runs a sequence of methods on it. This particular helper starts up a series of instances linearly, deploys some code, and then shuts down. Both after initially starting up, after peering each instance, and after deploy, it waits for the instance to converge before running the next step.
type Instance ¶
type Instance struct { // Etcd specifies that this is a pure etcd instance instead of an mgmt // one. Etcd bool // EtcdServer specifies we're connecting to an etcd instance instead of // a normal mgmt peer. EtcdServer bool // Hostname is a unique identifier for this instance. Hostname string // Preserve prevents the runtime output from being explicitly deleted. // This is helpful for running analysis or tests on the output. Preserve bool // Logf is a logger which should be used. Logf func(format string, v ...interface{}) // Debug enables more verbosity. Debug bool // contains filtered or unexported fields }
Instance represents a single running mgmt instance. It is a building block that can be used to run standalone tests, or combined to run clustered tests. It can also be used to run a standalone etcd server instance.
func (*Instance) CombinedOutput ¶
CombinedOutput returns the logged output from the instance.
func (*Instance) DeployLang ¶
DeployLang deploys some code to the cluster.
func (*Instance) Dir ¶
Dir returns the dir where the instance can write to. You should only use this after Init has been called, or it won't have been created and determined yet.
func (*Instance) Init ¶
Init runs some initialization for this instance. It errors if the struct was populated in an invalid way, or if it can't initialize correctly.
func (*Instance) Quit ¶
Quit sends a friendly shutdown request to the process. You can specify a context if you'd like to exit earlier. If you trigger an early exit with the context, then this will end up running a `kill -9` so it can return.
func (*Instance) SimpleDeployLang ¶
SimpleDeployLang is a helper method that takes a struct and runs a sequence of methods on it. This particular helper starts up an instance, deploys some code, and then shuts down. Both after initially starting up, and after deploy, it waits for the instance to converge before running the next step.