Documentation
¶
Index ¶
- type AgentMan
- func (am *AgentMan) Cluster(name string) (*TestCluster, bool)
- func (am *AgentMan) ClusterNames() []string
- func (am *AgentMan) ClustersCount() int
- func (am *AgentMan) Instance(name string) (*TestInstance, bool)
- func (am *AgentMan) InstanceNames() []string
- func (am *AgentMan) InstancesCount() int
- func (am *AgentMan) NewCluster(name string, size uint8, cb ClusterServerConfigCallback) (*TestCluster, error)
- func (am *AgentMan) NewInstance(name string, cb testutil.ServerConfigCallback) (*TestInstance, error)
- func (am *AgentMan) Stop() error
- func (am *AgentMan) StopCluster(name string) error
- func (am *AgentMan) StopInstance(name string) error
- type ClusterServerConfigCallback
- type Clusters
- type Instances
- type MultiErr
- type TestCluster
- func (cl *TestCluster) Grow(n uint8, cb ClusterServerConfigCallback) error
- func (cl *TestCluster) Instance(num uint8) *TestInstance
- func (cl *TestCluster) Name() string
- func (cl *TestCluster) Shrink(n uint8) error
- func (cl *TestCluster) Size() int
- func (cl *TestCluster) Stop() error
- func (cl *TestCluster) Stopped() bool
- type TestInstance
- func (ti *TestInstance) APIClient() *api.Client
- func (ti *TestInstance) Config() *testutil.TestServerConfig
- func (ti *TestInstance) HTTPAddr() string
- func (ti *TestInstance) HTTPClient() *http.Client
- func (ti *TestInstance) HTTPSAddr() string
- func (ti *TestInstance) LANAddr() string
- func (ti *TestInstance) Name() string
- func (ti *TestInstance) Stop() error
- func (ti *TestInstance) Stopped() bool
- func (ti *TestInstance) WANAddr() string
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 (*AgentMan) ClustersCount ¶
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 (*AgentMan) InstancesCount ¶
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 ¶
Stop will attempt to stop all currently running instances and clusters, removing all of them from the manager
func (*AgentMan) StopCluster ¶
StopCluster will attempt to stop a single cluster, removing it from this manager
func (*AgentMan) StopInstance ¶
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
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 ¶
func (cl *TestCluster) Grow(n uint8, cb ClusterServerConfigCallback) error
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