Documentation
¶
Overview ¶
Package fault implements fault injection rules (FR-CORE-060): inject an error code, latency or a dropped connection by service, method, resource pattern and probability or count.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Duration ¶
Duration is a time.Duration that (un)marshals as a Go duration string.
func (Duration) MarshalText ¶
func (*Duration) UnmarshalText ¶
type Rule ¶
type Rule struct {
ID string `json:"id" yaml:"id"`
// Service is the emulator service name ("gcs", "pubsub", ...).
Service string `json:"service,omitempty" yaml:"service"`
// Method is a regexp matched against the method: "GET /storage/v1/b"
// for HTTP, "/google.pubsub.v1.Publisher/Publish" for gRPC.
Method string `json:"method,omitempty" yaml:"method"`
// Resource is a regexp matched against the request path/resource.
Resource string `json:"resource,omitempty" yaml:"resource"`
// Code is the canonical error name to return (e.g. "UNAVAILABLE").
Code string `json:"code,omitempty" yaml:"code"`
// HTTPStatus overrides the HTTP status for Code.
HTTPStatus int `json:"httpStatus,omitempty" yaml:"httpStatus"`
// Latency is added before the request is handled (or the error returned).
Latency Duration `json:"latency,omitempty" yaml:"latency"`
// Drop closes the connection without a response.
Drop bool `json:"drop,omitempty" yaml:"drop"`
// Probability in (0,1]; 0 means always.
Probability float64 `json:"probability,omitempty" yaml:"probability"`
// Count limits how many times the rule fires; 0 means unlimited.
Count int `json:"count,omitempty" yaml:"count"`
// Fired is how many times the rule has fired.
Fired int `json:"fired" yaml:"-"`
// contains filtered or unexported fields
}
Rule is one fault-injection rule. Empty matchers match everything.