featureBreaker

package
v0.0.0-...-e6cee59 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 29, 2015 License: BSD-3-Clause Imports: 13 Imported by: 0

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

Constants

This section is empty.

Variables

View Source
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 FilterGI

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

FilterGI installs a counter info filter in the context.

func FilterMC

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

FilterMC installs a counter mc filter in the context.

func FilterMail

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

FilterMail installs a counter mail filter in the context.

func FilterRDS

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

FilterRDS installs a counter datastore filter in the context.

func FilterTQ

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

FilterTQ installs a counter TaskQueue filter in the context.

func FilterUser

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

FilterUser installs a counter user filter in the context.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL