Skip to main content

TestWorkflowRequest

Struct TestWorkflowRequest 

Source
pub struct TestWorkflowRequest {
    pub name: String,
    pub version: Option<i32>,
    pub input: HashMap<String, Value>,
    pub correlation_id: Option<String>,
    pub task_to_domain: HashMap<String, String>,
    pub workflow_def: Option<WorkflowDef>,
    pub external_input_payload_storage_path: Option<String>,
    pub priority: i32,
    pub task_ref_to_mock_output: HashMap<String, Vec<TaskMock>>,
    pub sub_workflow_test_request: HashMap<String, TestWorkflowRequest>,
}
Expand description

Request for testing a workflow. Extends StartWorkflowRequest’s field set with test-only fields (task_ref_to_mock_output/sub_workflow_test_request), matching the server’s WorkflowTestRequest extends StartWorkflowRequest exactly – this crate doesn’t have struct inheritance, so the shared fields are simply duplicated here rather than composed.

Fields§

§name: String

Workflow name.

§version: Option<i32>

Workflow version.

§input: HashMap<String, Value>

Workflow input.

§correlation_id: Option<String>

Correlation ID.

§task_to_domain: HashMap<String, String>

Task to domain mapping.

§workflow_def: Option<WorkflowDef>

Workflow definition (optional, uses registered if not provided).

§external_input_payload_storage_path: Option<String>

External input payload storage path.

§priority: i32

Priority.

§task_ref_to_mock_output: HashMap<String, Vec<TaskMock>>

Task reference to mocked-attempt-sequence mapping. Each entry is a TaskMock list, not a single output – see TestWorkflowRequest::with_mock_output/ TestWorkflowRequest::with_mock_outputs.

§sub_workflow_test_request: HashMap<String, TestWorkflowRequest>

Per-sub-workflow-task-reference test request, for mocking task outputs inside a sub-workflow the same way as the top-level workflow.

Implementations§

Source§

impl TestWorkflowRequest

Source

pub fn new(name: impl Into<String>) -> Self

Create a new test workflow request.

Source

pub fn with_version(self, version: i32) -> Self

Set version.

Source

pub fn with_workflow_def(self, def: WorkflowDef) -> Self

Set workflow definition.

Source

pub fn with_input(self, input: HashMap<String, Value>) -> Self

Set workflow input.

Source

pub fn with_correlation_id(self, correlation_id: impl Into<String>) -> Self

Set correlation ID.

Source

pub fn with_task_to_domain( self, task_to_domain: HashMap<String, String>, ) -> Self

Set task-to-domain routing.

Source

pub fn with_priority(self, priority: i32) -> Self

Set priority.

Source

pub fn with_mock_output( self, task_ref: impl Into<String>, output: HashMap<String, Value>, ) -> Self

Append a single COMPLETED mock attempt with output for task_ref. Calling this multiple times for the same task_ref builds a retry sequence – the attempt from the first call runs first. For non-COMPLETED attempts (simulating a failure before a retry succeeds) or execution/queue-time simulation, use TestWorkflowRequest::with_mock_outputs with TaskMock directly.

Source

pub fn with_mock_outputs( self, task_ref: impl Into<String>, mocks: Vec<TaskMock>, ) -> Self

Set the full mocked-attempt sequence for task_ref, replacing any previous mocks for it.

Source

pub fn with_sub_workflow_test_request( self, task_ref: impl Into<String>, request: TestWorkflowRequest, ) -> Self

Add a mock test request for the sub-workflow spawned at task_ref.

Trait Implementations§

Source§

impl Clone for TestWorkflowRequest

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TestWorkflowRequest

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for TestWorkflowRequest

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for TestWorkflowRequest

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more