gae: github.com/luci/gae/filter/featureBreaker Index | Files

package featureBreaker

import "github.com/luci/gae/filter/featureBreaker"

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

Package Files

doc.go featurebreaker.go gi.go mail.go mc.go mod.go rds.go tq.go user.go

Variables

var ErrBrokenFeaturesBroken = errors.New("featureBreaker: Unable to retrieve caller information")

ErrBrokenFeaturesBroken is returned from RunIfNotBroken when BrokenFeatures itself isn't working correctly.

func FilterGI Uses

func FilterGI(c context.Context, defaultError error) (context.Context, FeatureBreaker)

FilterGI installs a featureBreaker info filter in the context.

func FilterMC Uses

func FilterMC(c context.Context, defaultError error) (context.Context, FeatureBreaker)

FilterMC installs a featureBreaker mc filter in the context.

func FilterMail Uses

func FilterMail(c context.Context, defaultError error) (context.Context, FeatureBreaker)

FilterMail installs a featureBreaker mail filter in the context.

func FilterModule Uses

func FilterModule(c context.Context, defaultError error) (context.Context, FeatureBreaker)

FilterModule installs a featureBreaker module filter in the context.

func FilterRDS Uses

func FilterRDS(c context.Context, defaultError error) (context.Context, FeatureBreaker)

FilterRDS installs a featureBreaker datastore filter in the context.

func FilterTQ Uses

func FilterTQ(c context.Context, defaultError error) (context.Context, FeatureBreaker)

FilterTQ installs a featureBreaker TaskQueue filter in the context.

func FilterUser Uses

func FilterUser(c context.Context, defaultError error) (context.Context, FeatureBreaker)

FilterUser installs a featureBreaker user filter in the context.

type FeatureBreaker Uses

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.

Package featureBreaker imports 14 packages (graph). Updated 2017-01-15. Refresh now. Tools for package owners.