Documentation ¶
Overview ¶
Package mock contains helper functions for generating mock objects for testing
Index ¶
- func Dep() D.Deployment
- func Deps() deps.Deps
- func NewDeployment(apps map[string]D.AppMap) D.Deployment
- type AppFactory
- type Checker
- type Clock
- type ConfigGetter
- type Deployment
- func (d Deployment) AppNames() ([]string, error)
- func (d Deployment) Apps(c chan<- *D.App, apps []string)
- func (d Deployment) CloudProvider(account string) (string, error)
- func (d Deployment) GetApp(name string) (*D.App, error)
- func (d Deployment) GetClusterNames(app string, account D.AccountName) ([]D.ClusterName, error)
- func (d Deployment) GetInstanceIDs(app string, account D.AccountName, cloudProvider string, region D.RegionName, ...) (D.ASGName, []D.InstanceID, error)
- func (d Deployment) GetRegionNames(app string, account D.AccountName, cluster D.ClusterName) ([]D.RegionName, error)
- type Env
- type ErrorCounter
- type Executable
- type Instance
- type Outage
- type Terminator
- type Tracker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Dep ¶
func Dep() D.Deployment
Dep returns a mock implementation of deploy.Deployment Dep has 4 apps: foo, bar, baz, quux Each app runs in 1 account:
foo, bar, baz run in prod quux runs in test
Each app has one cluster: foo-prod, bar-prod, baz-prod Each cluster runs in one region: us-east-1 Each cluster contains 1 AZ with two instances
func Deps ¶
Deps returns a deps.Deps object that contains mocks. The mocks implement their interfaces by performing no-ops.
func NewDeployment ¶
func NewDeployment(apps map[string]D.AppMap) D.Deployment
NewDeployment returns a mock implementation of deploy.Deployment Pass in a deploy.AppMap, for example:
map[string]deploy.AppMap{ "foo": deploy.AppMap{"prod": {"foo-prod": {"us-east-1": {"foo-prod-v001": []string{"i-d3e3d611", "i-63f52e25"}}}}}, "bar": deploy.AppMap{"prod": {"bar-prod": {"us-east-1": {"bar-prod-v011": []string{"i-d7f06d45", "i-ce433cf1"}}}}}, "baz": deploy.AppMap{"prod": {"baz-prod": {"us-east-1": {"baz-prod-v004": []string{"i-25b86646", "i-573d46d5"}}}}}, "quux": deploy.AppMap{"test": {"quux-test": {"us-east-1": {"quux-test-v004": []string{"i-25b866ab", "i-892d46d5"}}}}}, }
Types ¶
type ConfigGetter ¶
type ConfigGetter struct {
Config chaosmonkey.AppConfig
}
ConfigGetter implements chaosmonkey.Getter
func DefaultConfigGetter ¶
func DefaultConfigGetter() ConfigGetter
DefaultConfigGetter returns a mock config getter that always returns the same config
func NewConfigGetter ¶
func NewConfigGetter(config chaosmonkey.AppConfig) ConfigGetter
NewConfigGetter returns a mock config getter that always returns the specified config
func (ConfigGetter) Get ¶
func (c ConfigGetter) Get(app string) (*chaosmonkey.AppConfig, error)
Get implements chaosmonkey.Getter.Get
type Deployment ¶
Deployment implements deploy.Deployment interface
func (Deployment) AppNames ¶
func (d Deployment) AppNames() ([]string, error)
AppNames implements deploy.Deployment.AppNames
func (Deployment) Apps ¶
func (d Deployment) Apps(c chan<- *D.App, apps []string)
Apps implements deploy.Deployment.Apps
func (Deployment) CloudProvider ¶
func (d Deployment) CloudProvider(account string) (string, error)
CloudProvider implements deploy.Deployment.CloudProvider
func (Deployment) GetApp ¶
func (d Deployment) GetApp(name string) (*D.App, error)
GetApp implements deploy.Deployment.GetApp
func (Deployment) GetClusterNames ¶
func (d Deployment) GetClusterNames(app string, account D.AccountName) ([]D.ClusterName, error)
GetClusterNames implements deploy.Deployment.GetClusterNames
func (Deployment) GetInstanceIDs ¶
func (d Deployment) GetInstanceIDs(app string, account D.AccountName, cloudProvider string, region D.RegionName, cluster D.ClusterName) (D.ASGName, []D.InstanceID, error)
GetInstanceIDs implements deploy.Deployment.GetInstanceIDs
func (Deployment) GetRegionNames ¶
func (d Deployment) GetRegionNames(app string, account D.AccountName, cluster D.ClusterName) ([]D.RegionName, error)
GetRegionNames implements deploy.Deployment.GetRegionNames
type ErrorCounter ¶
type ErrorCounter struct{}
ErrorCounter implements chaosmonkey.Publisher
func (ErrorCounter) Increment ¶
func (e ErrorCounter) Increment() error
Increment implements chaosmonkey.ErrorCounter.Increment
type Executable ¶
type Executable struct { // Path returns the path to executable Path string }
Executable is a mock representation of Chaosmonkey executable
func (Executable) ExecutablePath ¶
func (m Executable) ExecutablePath() (string, error)
ExecutablePath returns a mock implementation of command.CurrentExecutable.ExecutablePath
type Instance ¶
type Instance struct {
App, Account, Stack, Cluster, Region, ASG, InstanceID string
}
Instance implements instance.Instance
func (Instance) AccountName ¶
AccountName implements instance.AccountName
func (Instance) CloudProvider ¶
CloudProvider implements instance.IsContainer
func (Instance) ClusterName ¶
ClusterName implements instance.ClusterName
func (Instance) RegionName ¶
RegionName implements instance.RegionName
type Terminator ¶
Terminator implements term.terminator
func (*Terminator) Execute ¶
func (t *Terminator) Execute(trm chaosmonkey.Termination) error
Execute pretends to terminate an instance