31 lines
882 B
Rust
Raw Normal View History

use async_trait::async_trait;
2026-02-02 07:19:22 +01:00
use super::{Application, DynError, RunContext, runtime::context::RunMetrics};
#[async_trait]
/// Defines a check evaluated during or after a scenario run.
2026-02-02 07:19:22 +01:00
pub trait Expectation<E: Application>: Send + Sync {
fn name(&self) -> &str;
fn init(
&mut self,
2026-02-02 07:19:22 +01:00
_descriptors: &E::Deployment,
_run_metrics: &RunMetrics,
) -> Result<(), DynError> {
Ok(())
}
2026-02-02 07:19:22 +01:00
async fn start_capture(&mut self, _ctx: &RunContext<E>) -> Result<(), DynError> {
Ok(())
}
/// Optional periodic check used by fail-fast expectation mode.
///
/// Default is a no-op so existing expectations stay end-of-run only.
async fn check_during_capture(&mut self, _ctx: &RunContext<E>) -> Result<(), DynError> {
Ok(())
}
2026-02-02 07:19:22 +01:00
async fn evaluate(&mut self, ctx: &RunContext<E>) -> Result<(), DynError>;
}