utils

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2015 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearEtcd

func ClearEtcd(node TestbedNode)

func StartEtcd

func StartEtcd(nodes []TestbedNode) error

StartEtcd starts etcd on a specific host.

func StopEtcd

func StopEtcd(nodes []TestbedNode) error

StopEtcd stops etcd on a specific host

Types

type Dind

type Dind struct {
	// contains filtered or unexported fields
}

Dind implements docker-in-docker(dind) based testbed

func (*Dind) GetNodes

func (v *Dind) GetNodes() []TestbedNode

GetNodes returns the nodes in a dind setup

func (*Dind) Setup

func (v *Dind) Setup(start bool, env string, numNodes int) error

Setup brings up a dind testbed

func (*Dind) Teardown

func (v *Dind) Teardown()

Teardown cleans up a dind testbed

type DindNode

type DindNode struct {
	Name    string
	NodeNum int
}

DindNode implements a node in docker-in-docker (dind) testbed

func (DindNode) GetName

func (n DindNode) GetName() string

GetName returns dind node's name

func (DindNode) RunCommand

func (n DindNode) RunCommand(cmd string) error

RunCommand runs a shell command in a dind node and returns it's exit status

func (DindNode) RunCommandBackground

func (n DindNode) RunCommandBackground(cmd string) (string, error)

RunCommandBackground runs a background command in a dind node

func (DindNode) RunCommandWithOutput

func (n DindNode) RunCommandWithOutput(cmd string) (string, error)

RunCommandWithOutput runs a shell command in a dind node and returns it's exit status and output

type TestCommand

type TestCommand struct {
	ContivNodes int
	ContivEnv   string
}

TestCommand is a command that is run on a test node

func (*TestCommand) Run

func (c *TestCommand) Run(cmd string, args ...string) error

Run runs a command and return it's exit status

func (*TestCommand) RunWithOutput

func (c *TestCommand) RunWithOutput(cmd string, args ...string) ([]byte, error)

RunWithOutput runs a command and return it's exit status and output

type Testbed

type Testbed interface {
	Setup(start bool, env string, numNodes int) error
	Teardown()
	GetNodes() []TestbedNode
}

Testbed is a collection of test nodes

type TestbedNode

type TestbedNode interface {
	RunCommand(cmd string) (err error)
	RunCommandWithOutput(cmd string) (output string, err error)
	RunCommandBackground(cmd string) (output string, err error)
	GetName() string
}

TestbedNode is a node under test

type Vagrant

type Vagrant struct {
	// contains filtered or unexported fields
}

Vagrant implements a vagrant based testbed

func (*Vagrant) GetNode

func (v *Vagrant) GetNode(name string) TestbedNode

GetNode obtains a node by name.

func (*Vagrant) GetNodes

func (v *Vagrant) GetNodes() []TestbedNode

GetNodes returns the nodes in a vagrant setup

func (*Vagrant) IterateNodes

func (v *Vagrant) IterateNodes(fn func(TestbedNode) error) error

IterateNodes walks each host and executes the function supplied. On error, it waits for all hosts to complete before returning the error.

func (*Vagrant) SSHAllNodes

func (v *Vagrant) SSHAllNodes(cmd string) error

SSHAllNodes will ssh into each host and run the specified command.

func (*Vagrant) Setup

func (v *Vagrant) Setup(start bool, env string, numNodes int) error

Setup brings up a vagrant testbed

func (*Vagrant) Teardown

func (v *Vagrant) Teardown()

Teardown cleans up a vagrant testbed

type VagrantCommand

type VagrantCommand struct {
	ContivNodes int
	ContivEnv   string
}

VagrantCommand is a command that is run on a vagrant node

func (*VagrantCommand) Run

func (c *VagrantCommand) Run(cmd string, args ...string) error

Run runs a command and return it's exit status

func (*VagrantCommand) RunWithOutput

func (c *VagrantCommand) RunWithOutput(cmd string, args ...string) ([]byte, error)

RunWithOutput runs a command and return it's exit status and output

type VagrantNode

type VagrantNode struct {
	Name string
	// contains filtered or unexported fields
}

VagrantNode implements a node in vagrant testbed

func NewVagrantNode

func NewVagrantNode(name, port, privKeyFile string) (*VagrantNode, error)

NewVagrantNode intializes a node in vagrant testbed

func (*VagrantNode) Cleanup

func (n *VagrantNode) Cleanup()

Cleanup clears the ssh client resources

func (*VagrantNode) GetName

func (n *VagrantNode) GetName() string

GetName returns vagrant node's name

func (*VagrantNode) RunCommand

func (n *VagrantNode) RunCommand(cmd string) error

RunCommand runs a shell command in a vagrant node and returns it's exit status

func (*VagrantNode) RunCommandBackground

func (n *VagrantNode) RunCommandBackground(cmd string) (string, error)

RunCommandBackground runs a background command in a vagrant node

func (*VagrantNode) RunCommandWithOutput

func (n *VagrantNode) RunCommandWithOutput(cmd string) (string, error)

RunCommandWithOutput runs a shell command in a vagrant node and returns it's exit status and output

Jump to

Keyboard shortcuts

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