Documentation ¶
Index ¶
- Constants
- type Farmer
- func (f *Farmer) AbsLogDir() string
- func (f *Farmer) Add(nodes int) error
- func (f *Farmer) Addr(i int, port string) string
- func (f *Farmer) Assert(t *testing.T)
- func (f *Farmer) AssertAndStop(t *testing.T)
- func (f *Farmer) AssertState(t *testing.T, host, proc, expState string)
- func (f *Farmer) CollectLogs()
- func (f *Farmer) Destroy(t *testing.T) error
- func (f *Farmer) Exec(i int, cmd string) error
- func (f *Farmer) ExecRoot(i int, cmd []string) error
- func (f *Farmer) FirstInstance() string
- func (f *Farmer) Hostname(i int) string
- func (f *Farmer) InternalIP(i int) net.IP
- func (f *Farmer) Kill(i int) error
- func (f *Farmer) MustDestroy(t *testing.T)
- func (f *Farmer) NewClient(t *testing.T, i int) (*client.DB, *stop.Stopper)
- func (f *Farmer) Nodes() (hosts []string)
- func (f *Farmer) NumNodes() int
- func (f *Farmer) PGUrl(i int) string
- func (f *Farmer) Resize(nodes int) error
- func (f *Farmer) Restart(i int) error
- func (f *Farmer) Start(i int, process string) error
- func (f *Farmer) Stop(i int, process string) error
- func (f *Farmer) URL(i int) string
- func (f *Farmer) WaitReady(d time.Duration) error
Constants ¶
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.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Farmer ¶
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.
func (*Farmer) Assert ¶
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. TODO(cuongdo): doesn't handle load generators (photos, block_writer)
func (*Farmer) AssertAndStop ¶
AssertAndStop performs the same test as Assert but then proceeds to dismantle the cluster.
func (*Farmer) AssertState ¶
AssertState verifies that on the specified host, the given process (managed by supervisord) is in the expected state.
func (*Farmer) CollectLogs ¶
func (f *Farmer) CollectLogs()
CollectLogs copies all possibly interesting files from all available peers if LogDir is not empty.
func (*Farmer) FirstInstance ¶
FirstInstance returns the address of the first instance.
func (*Farmer) InternalIP ¶
InternalIP returns the address used for inter-node communication.
func (*Farmer) Kill ¶
Kill terminates the cockroach process running on the given node number. The given integer must be in the range [0,NumNodes()-1].
func (*Farmer) MustDestroy ¶
MustDestroy calls Destroy(), fataling on error.
func (*Farmer) Resize ¶
Resize is the counterpart to Add which resizes a cluster given the desired number of nodes.
func (*Farmer) Restart ¶
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].