Class FaultRule
- Namespace
- Kuestenlogik.Bowire.Mock.Chaos
- Assembly
- Kuestenlogik.Bowire.Mock.dll
One fault rule: method matcher + latency shape + fault behaviour.
public sealed class FaultRule
- Inheritance
-
FaultRule
- Inherited Members
Constructors
FaultRule()
public FaultRule()
Properties
Enabled
Toggle without deleting the rule. Default on — presence in the file opts in.
[JsonPropertyName("enabled")]
public bool Enabled { get; init; }
Property Value
ErrorStatusCode
Status returned by Error hits. Default 503.
[JsonPropertyName("errorStatusCode")]
public int ErrorStatusCode { get; init; }
Property Value
Kind
Fault behaviour. Default LatencyOnly.
[JsonPropertyName("kind")]
public FaultKind Kind { get; init; }
Property Value
Latency
Latency to inject on every match. Null → no delay.
[JsonPropertyName("latency")]
public FaultLatency? Latency { get; init; }
Property Value
Method
Service/Method glob, spanning any run of characters
(e.g. UserService/, /Get). Null / empty / *
matches every method. Case-insensitive.
[JsonPropertyName("method")]
public string? Method { get; init; }
Property Value
OnMiss
#411: when true, this rule applies to requests that matched NO stub
(instead of a matched step) — chaos-testing a client's handling of an
unknown/failing endpoint. The Method glob is ignored for
onMiss rules (a miss has no service/method); the first enabled
onMiss rule wins. Meaningful kinds: latency-only, error,
connection-drop, malformed-response (partial-response needs a body).
[JsonPropertyName("onMiss")]
public bool OnMiss { get; init; }
Property Value
PartialBytes
Response-body bytes forwarded before a PartialResponse truncates or a ConnectionDrop aborts. Default 1024.
[JsonPropertyName("partialBytes")]
public int PartialBytes { get; init; }
Property Value
PartialFrames
Frames forwarded before a PartialResponse ends a streaming replay, or a ConnectionDrop aborts it. Default 0 — no frame cap, and PartialBytes alone applies.
[JsonPropertyName("partialFrames")]
public int PartialFrames { get; init; }
Property Value
Remarks
The unit a streaming client actually reasons in (#170). A byte cap cuts an event in half, so the client sees a parse error rather than a stream that stopped — a different failure from the one being modelled. Set on a streaming step, this wins; on a unary one it is ignored, because there are no frames to count.
Honoured by every streaming replay: SSE, gRPC-streaming, WebSocket (both its frame-list and merged-timeline shapes), GraphQL subscriptions, SignalR and Socket.IO (text and binary emits alike). Each spends the budget at its own send, so a frame the replay skipped — a resumed client's, one with unusable payload — never counts against it.
Rate
Probability the Kind fires per matched request (0..1, default 1). The latency shape applies on every match regardless — latency models a slow dependency, the rate models an intermittent failure.
[JsonPropertyName("rate")]
public double Rate { get; init; }
Property Value
Methods
Describe()
One-line description for the audit trail ("error 503 @ rate 0.25 + uniform 100-500ms").
public string Describe()
Returns
MatchesMethod(string?, string?)
Case-insensitive glob match against service/method.
public bool MatchesMethod(string? service, string? method)