pub struct TaskMock {
pub status: TaskResultStatus,
pub output: Option<HashMap<String, Value>>,
pub execution_time: i64,
pub queue_wait_time: i64,
}Expand description
One simulated task attempt for TestWorkflowRequest::with_mock_outputs, matching the
server’s WorkflowTestRequest.TaskMock exactly (status/output/executionTime/
queueWaitTime). Multiple entries for the same task reference simulate a retry sequence:
the first entry is attempt 1, the second is attempt 2 if the workflow retries, and so on.
Fields§
§status: TaskResultStatusSimulated task status for this attempt.
output: Option<HashMap<String, Value>>Simulated task output for this attempt.
execution_time: i64Simulated execution time in milliseconds – useful for testing timeout handling.
queue_wait_time: i64Simulated queue wait time in milliseconds.
Implementations§
Source§impl TaskMock
impl TaskMock
Sourcepub fn completed(output: HashMap<String, Value>) -> Self
pub fn completed(output: HashMap<String, Value>) -> Self
A mock COMPLETED attempt with the given output – the common case.
Sourcepub fn new(status: TaskResultStatus, output: HashMap<String, Value>) -> Self
pub fn new(status: TaskResultStatus, output: HashMap<String, Value>) -> Self
A mock attempt with an explicit status (e.g. to simulate a retryable failure before a
later completed() attempt succeeds).
Sourcepub fn with_execution_time(self, millis: i64) -> Self
pub fn with_execution_time(self, millis: i64) -> Self
Set the simulated execution time, for testing timeout-handling logic.
Sourcepub fn with_queue_wait_time(self, millis: i64) -> Self
pub fn with_queue_wait_time(self, millis: i64) -> Self
Set the simulated queue wait time.