fault

package
v0.0.0-...-2d5464a Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2015 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package fault handles fault injection for testing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Injector

type Injector struct {
	// contains filtered or unexported fields
}

An Injector reports whether fake errors should be returned.

func NewInjector

func NewInjector(name string) *Injector

NewInjector returns a new fault injector with the given name. The environment variable "FAULT_" + capital(name) + "_FAIL_PERCENT" controls the percentage of requests that fail. If undefined or zero, no requests fail.

func (*Injector) FailErr

func (in *Injector) FailErr(err *error) bool

FailErr checks ShouldFail and, if true, assigns a fake error to err and returns true.

func (*Injector) ShouldFail

func (in *Injector) ShouldFail() bool

ShouldFail reports whether a fake error should be returned.

Jump to

Keyboard shortcuts

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