pub struct FaultController { /* private fields */ }Expand description
Shared deterministic fault plan and execution counters.
Implementations§
Source§impl FaultController
impl FaultController
Sourcepub fn model_fault(self, fault: ModelFault) -> Self
pub fn model_fault(self, fault: ModelFault) -> Self
Queues a fault for the next model invocation.
Sourcepub fn disconnect_after_tool_call(self) -> Self
pub fn disconnect_after_tool_call(self) -> Self
Disconnects the next model stream after a completed Tool call.
Sourcepub fn disconnect_after_model_events(self, events: usize) -> Self
pub fn disconnect_after_model_events(self, events: usize) -> Self
Disconnects the next model stream after events canonical events.
Sourcepub fn fail_next_model(self, error: ModelError) -> Self
pub fn fail_next_model(self, error: ModelError) -> Self
Fails the next model invocation before opening its stream.
Sourcepub fn tool_fault(self, fault: ToolFault) -> Self
pub fn tool_fault(self, fault: ToolFault) -> Self
Queues a named Tool fault.
Sourcepub fn fail_tool_on_invocation(
self,
tool: impl Into<String>,
invocation: u64,
error: ToolError,
) -> Self
pub fn fail_tool_on_invocation( self, tool: impl Into<String>, invocation: u64, error: ToolError, ) -> Self
Fails the selected one-based invocation of a named Tool.
Sourcepub fn model<M>(&self, model: M) -> FaultInjectingModel<M>where
M: Model,
pub fn model<M>(&self, model: M) -> FaultInjectingModel<M>where
M: Model,
Wraps a model with this plan.
Sourcepub fn tool(&self, tool: Arc<dyn Tool>) -> FaultInjectingTool
pub fn tool(&self, tool: Arc<dyn Tool>) -> FaultInjectingTool
Wraps a Tool with this plan.
Sourcepub fn tool_invocations(&self, tool: &str) -> u64
pub fn tool_invocations(&self, tool: &str) -> u64
Returns the number of observed invocations for one Tool.
Sourcepub fn tool_executions(&self, tool: &str) -> u64
pub fn tool_executions(&self, tool: &str) -> u64
Returns the number of calls forwarded to the underlying Tool.
Sourcepub fn runtime_restarts(&self) -> u64
pub fn runtime_restarts(&self) -> u64
Returns the number of explicit runtime reconstructions.
Sourcepub fn assert_tool_executed_exactly(
&self,
tool: &str,
expected: u64,
) -> Result<(), ScenarioAssertionError>
pub fn assert_tool_executed_exactly( &self, tool: &str, expected: u64, ) -> Result<(), ScenarioAssertionError>
Asserts exact Tool execution count with a typed failure.
§Errors
Returns ScenarioAssertionError when the observed count differs.
Trait Implementations§
Source§impl Clone for FaultController
impl Clone for FaultController
Source§fn clone(&self) -> FaultController
fn clone(&self) -> FaultController
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FaultController
impl Debug for FaultController
Source§impl Default for FaultController
impl Default for FaultController
Source§fn default() -> FaultController
fn default() -> FaultController
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for FaultController
impl RefUnwindSafe for FaultController
impl Send for FaultController
impl Sync for FaultController
impl Unpin for FaultController
impl UnsafeUnpin for FaultController
impl UnwindSafe for FaultController
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
Mutably borrows from an owned value. Read more