Documentation
¶
Overview ¶
Package featureBreaker contains filters for dynamically disabling/breaking API features at test-time.
In particular, it can be used to cause specific service methods to start returning specific errors during the test.
Index ¶
- Variables
- type FeatureBreaker
- func FilterGI(c context.Context, defaultError error) (context.Context, FeatureBreaker)
- func FilterMC(c context.Context, defaultError error) (context.Context, FeatureBreaker)
- func FilterMail(c context.Context, defaultError error) (context.Context, FeatureBreaker)
- func FilterRDS(c context.Context, defaultError error) (context.Context, FeatureBreaker)
- func FilterTQ(c context.Context, defaultError error) (context.Context, FeatureBreaker)
- func FilterUser(c context.Context, defaultError error) (context.Context, FeatureBreaker)
Constants ¶
This section is empty.
Variables ¶
var ErrBrokenFeaturesBroken = errors.New("featureBreaker: Unable to retrieve caller information")
ErrBrokenFeaturesBroken is returned from RunIfNotBroken when BrokenFeatures itself isn't working correctly.
Functions ¶
This section is empty.
Types ¶
type FeatureBreaker ¶
type FeatureBreaker interface { BreakFeatures(err error, feature ...string) UnbreakFeatures(feature ...string) }
FeatureBreaker is the state-access interface for all Filter* functions in this package. A feature is the Name of some method on the filtered service. So if you had:
c, fb := FilterMC(...) mc := gae.GetMC(c)
you could do:
fb.BreakFeatures(memcache.ErrServerError, "Add", "Set")
and then
mc.Add(...) and mc.Set(...)
would return the error.
You may also pass nil as the error for BreakFeatures, and the fake will provide the DefaultError which you passed to the Filter function.
This interface can only break features which return errors.
func FilterMail ¶
FilterMail installs a counter mail filter in the context.
func FilterUser ¶
FilterUser installs a counter user filter in the context.