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: StringWorkflow 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: i32Priority.
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
impl TestWorkflowRequest
Sourcepub fn with_version(self, version: i32) -> Self
pub fn with_version(self, version: i32) -> Self
Set version.
Sourcepub fn with_workflow_def(self, def: WorkflowDef) -> Self
pub fn with_workflow_def(self, def: WorkflowDef) -> Self
Set workflow definition.
Sourcepub fn with_input(self, input: HashMap<String, Value>) -> Self
pub fn with_input(self, input: HashMap<String, Value>) -> Self
Set workflow input.
Sourcepub fn with_correlation_id(self, correlation_id: impl Into<String>) -> Self
pub fn with_correlation_id(self, correlation_id: impl Into<String>) -> Self
Set correlation ID.
Sourcepub fn with_task_to_domain(
self,
task_to_domain: HashMap<String, String>,
) -> Self
pub fn with_task_to_domain( self, task_to_domain: HashMap<String, String>, ) -> Self
Set task-to-domain routing.
Sourcepub fn with_priority(self, priority: i32) -> Self
pub fn with_priority(self, priority: i32) -> Self
Set priority.
Sourcepub fn with_mock_output(
self,
task_ref: impl Into<String>,
output: HashMap<String, Value>,
) -> Self
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.
Sourcepub fn with_mock_outputs(
self,
task_ref: impl Into<String>,
mocks: Vec<TaskMock>,
) -> Self
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.
Sourcepub fn with_sub_workflow_test_request(
self,
task_ref: impl Into<String>,
request: TestWorkflowRequest,
) -> Self
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.