package fault
import "go4.org/fault"
Package fault handles fault injection for testing.
Index ¶
Types ¶
type Injector ¶
type Injector struct {
// contains filtered or unexported fields
}
An Injector reports whether fake errors should be returned.
func NewInjector ¶
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 ¶
FailErr checks ShouldFail and, if true, assigns a fake error to err and returns true.
func (*Injector) ShouldFail ¶
ShouldFail reports whether a fake error should be returned.
Source Files ¶
fault.go
- Version
- v0.0.0-20230225012048-214862532bf5 (latest)
- Published
- Feb 25, 2023
- Platform
- linux/amd64
- Imports
- 5 packages
- Last checked
- 1 month ago –
Tools for package owners.