pub struct MockWorkflowDispatch { /* private fields */ }Expand description
Records started workflows for later verification.
Implementations§
Source§impl MockWorkflowDispatch
impl MockWorkflowDispatch
pub fn new() -> MockWorkflowDispatch
pub async fn start<T>(
&self,
workflow_name: &str,
input: T,
) -> Result<Uuid, ForgeError>where
T: Serialize,
pub fn started_workflows(&self) -> Vec<StartedWorkflow>
pub fn workflows_named(&self, name: &str) -> Vec<StartedWorkflow>
pub fn assert_started(&self, workflow_name: &str)
pub fn assert_started_with<F>(&self, workflow_name: &str, predicate: F)
pub fn assert_not_started(&self, workflow_name: &str)
pub fn assert_start_count(&self, workflow_name: &str, expected: usize)
pub fn clear(&self)
pub fn complete_workflow(&self, run_id: Uuid)
pub fn fail_workflow(&self, run_id: Uuid)
Trait Implementations§
Source§impl Default for MockWorkflowDispatch
impl Default for MockWorkflowDispatch
Source§fn default() -> MockWorkflowDispatch
fn default() -> MockWorkflowDispatch
Returns the “default value” for a type. Read more
Source§impl WorkflowDispatch for MockWorkflowDispatch
impl WorkflowDispatch for MockWorkflowDispatch
Source§fn get_info(&self, _workflow_name: &str) -> Option<WorkflowInfo>
fn get_info(&self, _workflow_name: &str) -> Option<WorkflowInfo>
Get workflow info by name for auth checking.
Source§fn start_by_name(
&self,
workflow_name: &str,
input: Value,
_owner_subject: Option<String>,
_trace_id: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<Uuid, ForgeError>> + Send + '_>>
fn start_by_name( &self, workflow_name: &str, input: Value, _owner_subject: Option<String>, _trace_id: Option<String>, ) -> Pin<Box<dyn Future<Output = Result<Uuid, ForgeError>> + Send + '_>>
Start a workflow by its registered name. Read more
Source§fn start_in_conn<'a>(
&'a self,
_conn: &'a mut PgConnection,
workflow_name: &'a str,
input: Value,
_owner_subject: Option<String>,
_trace_id: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<Uuid, ForgeError>> + Send + 'a>>
fn start_in_conn<'a>( &'a self, _conn: &'a mut PgConnection, workflow_name: &'a str, input: Value, _owner_subject: Option<String>, _trace_id: Option<String>, ) -> Pin<Box<dyn Future<Output = Result<Uuid, ForgeError>> + Send + 'a>>
Start a workflow on an existing connection — typically the live
transaction inside a
MutationContext. The run row and its
$workflow_resume job are written in the same transaction so the
worker only picks the run up after commit.Auto Trait Implementations§
impl !Freeze for MockWorkflowDispatch
impl RefUnwindSafe for MockWorkflowDispatch
impl Send for MockWorkflowDispatch
impl Sync for MockWorkflowDispatch
impl Unpin for MockWorkflowDispatch
impl UnsafeUnpin for MockWorkflowDispatch
impl UnwindSafe for MockWorkflowDispatch
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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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>
Converts
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>
Converts
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