Documentation
¶
Overview ¶
Package chaostest provides testing.TB integration helpers for chaotic. The most-used function is New, which returns a fresh engine bound to the test's t.Cleanup so faults from one test never leak into another.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertEventsExhausted ¶
AssertEventsExhausted fails t if any named rule on eng has not fired at least once. Useful for asserting "every chaos rule I configured was actually exercised by my test".
func AssertHits ¶
AssertHits fails t with a clear message if eng has not fired ruleName exactly want times.
Types ¶
type Event ¶ added in v1.4.0
Event is one observed engine decision. Fired distinguishes a RuleFired event (Fired=true, Reason="") from a RuleSkipped event (Fired=false, Reason set).
type Recorder ¶ added in v1.4.0
type Recorder struct {
// contains filtered or unexported fields
}
Recorder is an engine.Observer that records events for assertions. Attach it with engine.WithObserver. Safe for concurrent use. Methods run on the request path. A Recorder is an instance - never share one across engines you want to assert independently.
func NewRecorder ¶ added in v1.4.0
func NewRecorder() *Recorder
NewRecorder returns an empty Recorder.
func (*Recorder) Fired ¶ added in v1.4.0
Fired returns the fired events for ruleName (or all fired events if "").
func (*Recorder) RuleSkipped ¶ added in v1.4.0
RuleSkipped adds an event of skipped rule to the recorder.