Documentation ¶
Overview ¶
Package mock contains helper functions for generating mock objects for testing
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Deployment ¶
func Deployment() D.Deployment
Deployment returns a mock implementation of deploy.Deployment Deployment 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 Checker ¶
type Checker struct {
Error error
}
Checker implements deps.Checker
func (Checker) Check ¶
func (c Checker) Check(term chaosmonkey.Termination, appCfg chaosmonkey.AppConfig, endHour int, loc *time.Location) error
Check implements deps.Checker.Check
type ConfigGetter ¶
type ConfigGetter struct{}
ConfigGetter implements chaosmonkey.Getter
func (ConfigGetter) Get ¶
func (c ConfigGetter) Get(app string) (*chaosmonkey.AppConfig, error)
Get implements chaosmonkey.Getter.Get
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 ¶
type Terminator struct { Instance chaosmonkey.Instance Ncalls int Error error }
Terminator implements term.terminator
func (*Terminator) Execute ¶
func (t *Terminator) Execute(trm chaosmonkey.Termination) error
Execute pretends to terminate an instance
type Tracker ¶
type Tracker struct {
Error error
}
Tracker implements chaosmonkey.Tracker
func (Tracker) Track ¶
func (t Tracker) Track(trm chaosmonkey.Termination) error
Track implements chaosmonkey.Tracker.Track