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

bool

ErrorStatusCode

Status returned by Error hits. Default 503.

[JsonPropertyName("errorStatusCode")]
public int ErrorStatusCode { get; init; }

Property Value

int

Kind

Fault behaviour. Default LatencyOnly.

[JsonPropertyName("kind")]
public FaultKind Kind { get; init; }

Property Value

FaultKind

Latency

Latency to inject on every match. Null → no delay.

[JsonPropertyName("latency")]
public FaultLatency? Latency { get; init; }

Property Value

FaultLatency

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

string

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

bool

PartialBytes

Response-body bytes forwarded before a PartialResponse truncates or a ConnectionDrop aborts. Default 1024.

[JsonPropertyName("partialBytes")]
public int PartialBytes { get; init; }

Property Value

int

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

double

Methods

Describe()

One-line description for the audit trail ("error 503 @ rate 0.25 + uniform 100-500ms").

public string Describe()

Returns

string

MatchesMethod(string?, string?)

Case-insensitive glob match against service/method.

public bool MatchesMethod(string? service, string? method)

Parameters

service string
method string

Returns

bool