agentman

package module
v0.0.0-...-5d2a8eb Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2017 License: MIT Imports: 8 Imported by: 0

README

agentman

Help utility for managing Consul TestServer instances

Build Status

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentMan

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

func NewAgentMan

func NewAgentMan() *AgentMan

func (*AgentMan) Cluster

func (am *AgentMan) Cluster(name string) (*TestCluster, bool)

Cluster will attempt to return a registered test cluster to you

func (*AgentMan) ClusterNames

func (am *AgentMan) ClusterNames() []string

func (*AgentMan) ClustersCount

func (am *AgentMan) ClustersCount() int

func (*AgentMan) Instance

func (am *AgentMan) Instance(name string) (*TestInstance, bool)

Instance will attempt to return a registered non-clustered test instance to you

func (*AgentMan) InstanceNames

func (am *AgentMan) InstanceNames() []string

func (*AgentMan) InstancesCount

func (am *AgentMan) InstancesCount() int

func (*AgentMan) NewCluster

func (am *AgentMan) NewCluster(name string, size uint8, cb ClusterServerConfigCallback) (*TestCluster, error)

NewCluster will attempt to create a clustered set of test instances

func (*AgentMan) NewInstance

func (am *AgentMan) NewInstance(name string, cb testutil.ServerConfigCallback) (*TestInstance, error)

NewInstance will attempt to create an un-clustered test instance

func (*AgentMan) Stop

func (am *AgentMan) Stop() error

Stop will attempt to stop all currently running instances and clusters, removing all of them from the manager

func (*AgentMan) StopCluster

func (am *AgentMan) StopCluster(name string) error

StopCluster will attempt to stop a single cluster, removing it from this manager

func (*AgentMan) StopInstance

func (am *AgentMan) StopInstance(name string) error

StopInstance will attempt to stop a single instance, removing it from this manager

type ClusterServerConfigCallback

type ClusterServerConfigCallback = func(name string, num uint8, conf *testutil.TestServerConfig)

ClusterServerConfigCallback is a small wrapper around testutil.ServerConfigCallback that adds scope

var DefaultClusterServerConfigCallback ClusterServerConfigCallback = func(name string, num uint8, conf *testutil.TestServerConfig) {
	conf.Performance.RaftMultiplier = 1
	conf.DisableCheckpoint = false
	if num == 0 {
		conf.Bootstrap = true
	} else {
		conf.Bootstrap = false
	}
}

type Clusters

type Clusters map[string]*TestCluster

type Instances

type Instances map[string]*TestInstance

type MultiErr

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

func NewMultiErr

func NewMultiErr() *MultiErr

func (*MultiErr) Add

func (e *MultiErr) Add(err error)

Add will add an error, ignoring nils

func (*MultiErr) Err

func (e *MultiErr) Err() error

func (*MultiErr) Error

func (e *MultiErr) Error() string

func (*MultiErr) Size

func (e *MultiErr) Size() int

Size returns the entire size of this multi error

func (*MultiErr) String

func (e *MultiErr) String() string

type TestCluster

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

TestCluster represents 2 or more agents running as a cluster

func NewTestCluster

func NewTestCluster(name string, size uint8, cb ClusterServerConfigCallback) (*TestCluster, error)

NewTestCluster will attempt to spin up a cluster of consul test servers of the specified size

func (*TestCluster) Grow

Grow will attempt to add n number of test instances to the cluster

func (*TestCluster) Instance

func (cl *TestCluster) Instance(num uint8) *TestInstance

Instance will attempt to return a single instance from this cluster

func (*TestCluster) Name

func (cl *TestCluster) Name() string

func (*TestCluster) Shrink

func (cl *TestCluster) Shrink(n uint8) error

Shrink will reduce the # of servers in the cluster, starting with the most recently added.

func (*TestCluster) Size

func (cl *TestCluster) Size() int

func (*TestCluster) Stop

func (cl *TestCluster) Stop() error

Stop will attempt to stop the entire cluster. Once called, the cluster is considered defunct and all further interactions will cause a panic

func (*TestCluster) Stopped

func (cl *TestCluster) Stopped() bool

type TestInstance

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

TestInstance represents a single instance of a consul test server and its client. May be alone or in a cluster.

func NewTestInstance

func NewTestInstance(name string, cb testutil.ServerConfigCallback) (*TestInstance, error)

NewTestInstance will attempt to create a new consul test server and api client

func (*TestInstance) APIClient

func (ti *TestInstance) APIClient() *api.Client

func (*TestInstance) Config

func (ti *TestInstance) Config() *testutil.TestServerConfig

Config returns pointer to the underlying test server config. Modify at your own risk.

func (*TestInstance) HTTPAddr

func (ti *TestInstance) HTTPAddr() string

func (*TestInstance) HTTPClient

func (ti *TestInstance) HTTPClient() *http.Client

func (*TestInstance) HTTPSAddr

func (ti *TestInstance) HTTPSAddr() string

func (*TestInstance) LANAddr

func (ti *TestInstance) LANAddr() string

func (*TestInstance) Name

func (ti *TestInstance) Name() string

func (*TestInstance) Stop

func (ti *TestInstance) Stop() error

Stop attempts to stop the underlying test server and nils about both the server and the client. This instance is considered defunct after this action, and all further interaction will cause a panic.

func (*TestInstance) Stopped

func (ti *TestInstance) Stopped() bool

func (*TestInstance) WANAddr

func (ti *TestInstance) WANAddr() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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