pub struct FaultConfig {Show 17 fields
pub enabled: bool,
pub http_errors: Vec<u16>,
pub http_error_probability: f64,
pub connection_errors: bool,
pub connection_error_probability: f64,
pub connection_error_kind: ConnectionErrorKindConfig,
pub timeout_errors: bool,
pub timeout_ms: u64,
pub timeout_probability: f64,
pub partial_responses: bool,
pub partial_response_probability: f64,
pub payload_corruption: bool,
pub payload_corruption_probability: f64,
pub corruption_type: CorruptionTypeConfig,
pub error_pattern: Option<ErrorPatternConfig>,
pub mockai_enabled: bool,
pub request_matcher: Option<RequestMatcherConfig>,
}Expand description
Fault injection configuration for chaos engineering.
Field set mirrors mockforge_chaos::config::FaultInjectionConfig so that
--config chaos.yaml can configure every fault knob the chaos middleware
understands. The bridge in serve.rs converts this to the chaos crate’s
type at runtime.
Fields§
§enabled: boolEnable fault injection.
http_errors: Vec<u16>HTTP status codes to randomly return (e.g., [500, 502, 503]).
http_error_probability: f64Probability of returning HTTP errors (0.0 to 1.0).
connection_errors: boolEnable connection errors.
connection_error_probability: f64Probability of connection errors (0.0 to 1.0).
connection_error_kind: ConnectionErrorKindConfigWhat “connection error” means at the wire level — HTTP 503 (default,
back-compat), TCP RST, or TCP FIN. The TCP variants require the chaos
listener wrapper, which the bridge installs automatically when
connection_errors is enabled and this is tcp_reset / tcp_close.
timeout_errors: boolEnable timeout errors.
timeout_ms: u64Timeout duration in milliseconds.
timeout_probability: f64Probability of timeout errors (0.0 to 1.0).
partial_responses: boolEnable partial-response truncation. Non-chunked responses keep the
original Content-Length so clients see an unexpected EOF; chunked
responses end without the terminating 0\r\n\r\n.
partial_response_probability: f64Probability of truncating a response (0.0 to 1.0).
payload_corruption: boolEnable payload corruption (post-response, before send).
payload_corruption_probability: f64Probability of corrupting a response payload (0.0 to 1.0).
corruption_type: CorruptionTypeConfigType of corruption to apply when payload_corruption fires.
error_pattern: Option<ErrorPatternConfig>Optional structured pattern for error injection (Burst / Random /
Sequential). When None, the per-fault probabilities above govern
firing independently.
mockai_enabled: boolEnable MockAI-driven dynamic error generation (advanced).
request_matcher: Option<RequestMatcherConfig>Optional per-request matcher. When set, faults only fire for
requests that match (AND across populated fields). None = always.
Trait Implementations§
Source§impl Clone for FaultConfig
impl Clone for FaultConfig
Source§fn clone(&self) -> FaultConfig
fn clone(&self) -> FaultConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FaultConfig
impl Debug for FaultConfig
Source§impl Default for FaultConfig
impl Default for FaultConfig
Source§fn default() -> FaultConfig
fn default() -> FaultConfig
Source§impl<'de> Deserialize<'de> for FaultConfigwhere
FaultConfig: Default,
impl<'de> Deserialize<'de> for FaultConfigwhere
FaultConfig: Default,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for FaultConfig
impl JsonSchema for FaultConfig
Source§fn schema_name() -> String
fn schema_name() -> String
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref keyword. Read moreAuto Trait Implementations§
impl Freeze for FaultConfig
impl RefUnwindSafe for FaultConfig
impl Send for FaultConfig
impl Sync for FaultConfig
impl Unpin for FaultConfig
impl UnsafeUnpin for FaultConfig
impl UnwindSafe for FaultConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more