import "github.com/abhinavdahiya/cockroach/acceptance/terrafarm"
const ( // KeepClusterAlways lets Farmer always keep the test cluster. KeepClusterAlways = "always" // KeepClusterFailed lets Farmer keep only failed test clusters. KeepClusterFailed = "failed" // KeepClusterNever lets Farmer always destroy the test cluster. KeepClusterNever = "never" )
The constants below are the possible values of the KeepCluster field.
type Farmer struct { Output io.Writer Cwd, LogDir string KeyName string Stores string // Prefix will be prepended all names of resources created by Terraform. Prefix string // StateFile is the file (under `Cwd`) in which Terraform will stores its // state. StateFile string // AddVars are additional Terraform variables to be set during calls to Add. AddVars map[string]string KeepCluster string // contains filtered or unexported fields }
A Farmer sets up and manipulates a test cluster via terraform.
AbsLogDir returns the absolute log dir to which logs are written.
Add provisions the given number of nodes and block writers, respectively.
Addr returns the host and port from the node in the format HOST:PORT.
Assert verifies that the cluster state is as expected (i.e. no unexpected restarts or node deaths occurred). Tests can call this periodically to ascertain cluster health. TODO(tschottdorf): unimplemented when nodes are expected down.
AssertAndStop performs the same test as Assert but then proceeds to dismantle the cluster.
CollectLogs copies all possibly interesting files from all available peers if LogDir is not empty.
Destroy collects the logs and tears down the cluster.
Exec executes the given command on the i-th node, returning (in that order) stdout, stderr and an error.
ExecRoot executes the given command with super-user privileges.
FirstInstance returns the address of the first instance.
InternalIP returns the address used for inter-node communication.
Kill terminates the cockroach process running on the given node number. The given integer must be in the range [0,NumNodes()-1].
MustDestroy calls Destroy(), fataling on error.
NewClient implements the Cluster interface.
Nodes returns a (copied) slice of provisioned nodes' host names.
NumNodes returns the number of nodes.
NumWriters returns the number of block writers.
PGUrl returns a URL string for the given node postgres server.
Resize is the counterpart to Add which resizes a cluster given the desired number of nodes and writers.
Restart terminates the cockroach process running on the given node number, unless it is already stopped, and restarts it. The given integer must be in the range [0,NumNodes()-1].
URL returns the HTTP(s) endpoint.
WaitReady waits until the infrastructure is in a state that *should* allow for a healthy cluster. Currently, this means waiting for the load balancer to resolve from all nodes.
Writers returns a (copied) slice of provisioned block writers' host names.
Package terrafarm imports 19 packages (graph). Updated 2017-03-13. Refresh now. Tools for package owners. This is a dead-end fork (no commits since the fork).