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.
ErrBrokenFeaturesBroken is returned from RunIfNotBroken when BrokenFeatures itself isn't working correctly.
FilterGI installs a featureBreaker info filter in the context.
FilterMC installs a featureBreaker mc filter in the context.
FilterMail installs a featureBreaker mail filter in the context.
FilterModule installs a featureBreaker module filter in the context.
FilterRDS installs a featureBreaker datastore filter in the context.
FilterTQ installs a featureBreaker TaskQueue filter in the context.
FilterUser installs a featureBreaker user filter in the context.
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")
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.