cockroach: github.com/abhinavdahiya/cockroach/acceptance/terrafarm Index | Files

package terrafarm

import "github.com/abhinavdahiya/cockroach/acceptance/terrafarm"

Index

Package Files

farmer.go run.go ssh.go

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.

type Farmer Uses

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) AbsLogDir Uses

func (f *Farmer) AbsLogDir() string

AbsLogDir returns the absolute log dir to which logs are written.

func (*Farmer) Add Uses

func (f *Farmer) Add(nodes, writers int) error

Add provisions the given number of nodes and block writers, respectively.

func (*Farmer) Addr Uses

func (f *Farmer) Addr(i int) string

Addr returns the host and port from the node in the format HOST:PORT.

func (*Farmer) Assert Uses

func (f *Farmer) Assert(t *testing.T)

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.

func (*Farmer) AssertAndStop Uses

func (f *Farmer) AssertAndStop(t *testing.T)

AssertAndStop performs the same test as Assert but then proceeds to dismantle the cluster.

func (*Farmer) CollectLogs Uses

func (f *Farmer) CollectLogs()

CollectLogs copies all possibly interesting files from all available peers if LogDir is not empty.

func (*Farmer) Destroy Uses

func (f *Farmer) Destroy(t *testing.T) error

Destroy collects the logs and tears down the cluster.

func (*Farmer) Exec Uses

func (f *Farmer) Exec(i int, cmd string) error

Exec executes the given command on the i-th node, returning (in that order) stdout, stderr and an error.

func (*Farmer) ExecRoot Uses

func (f *Farmer) ExecRoot(i int, cmd []string) error

ExecRoot executes the given command with super-user privileges.

func (*Farmer) FirstInstance Uses

func (f *Farmer) FirstInstance() string

FirstInstance returns the address of the first instance.

func (*Farmer) InternalIP Uses

func (f *Farmer) InternalIP(i int) net.IP

InternalIP returns the address used for inter-node communication.

func (*Farmer) Kill Uses

func (f *Farmer) Kill(i int) error

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 Uses

func (f *Farmer) MustDestroy(t *testing.T)

MustDestroy calls Destroy(), fataling on error.

func (*Farmer) NewClient Uses

func (f *Farmer) NewClient(t *testing.T, i int) (*client.DB, *stop.Stopper)

NewClient implements the Cluster interface.

func (*Farmer) Nodes Uses

func (f *Farmer) Nodes() (hosts []string)

Nodes returns a (copied) slice of provisioned nodes' host names.

func (*Farmer) NumNodes Uses

func (f *Farmer) NumNodes() int

NumNodes returns the number of nodes.

func (*Farmer) NumWriters Uses

func (f *Farmer) NumWriters() int

NumWriters returns the number of block writers.

func (*Farmer) PGUrl Uses

func (f *Farmer) PGUrl(i int) string

PGUrl returns a URL string for the given node postgres server.

func (*Farmer) Resize Uses

func (f *Farmer) Resize(nodes, writers int) error

Resize is the counterpart to Add which resizes a cluster given the desired number of nodes and writers.

func (*Farmer) Restart Uses

func (f *Farmer) Restart(i int) error

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].

func (*Farmer) URL Uses

func (f *Farmer) URL(i int) string

URL returns the HTTP(s) endpoint.

func (*Farmer) WaitReady Uses

func (f *Farmer) WaitReady(d time.Duration) error

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.

func (*Farmer) Writers Uses

func (f *Farmer) Writers() (hosts []string)

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).