@temporalio/core-bridge 0.16.4 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cargo.lock +339 -226
- package/Cargo.toml +7 -3
- package/common.js +50 -0
- package/index.d.ts +7 -0
- package/index.js +12 -0
- package/package.json +7 -4
- package/releases/aarch64-apple-darwin/index.node +0 -0
- package/releases/aarch64-unknown-linux-gnu/index.node +0 -0
- package/{index.node → releases/index.node} +0 -0
- package/releases/x86_64-apple-darwin/index.node +0 -0
- package/releases/x86_64-pc-windows-msvc/index.node +0 -0
- package/releases/x86_64-unknown-linux-gnu/index.node +0 -0
- package/scripts/build.js +10 -50
- package/sdk-core/.buildkite/docker/Dockerfile +1 -1
- package/sdk-core/.buildkite/docker/docker-compose.yaml +2 -2
- package/sdk-core/.buildkite/pipeline.yml +2 -0
- package/sdk-core/Cargo.toml +1 -88
- package/sdk-core/README.md +30 -6
- package/sdk-core/bridge-ffi/Cargo.toml +24 -0
- package/sdk-core/bridge-ffi/LICENSE.txt +23 -0
- package/sdk-core/bridge-ffi/build.rs +25 -0
- package/sdk-core/bridge-ffi/include/sdk-core-bridge.h +216 -0
- package/sdk-core/bridge-ffi/src/lib.rs +829 -0
- package/sdk-core/bridge-ffi/src/wrappers.rs +193 -0
- package/sdk-core/client/Cargo.toml +32 -0
- package/sdk-core/{src/pollers/gateway.rs → client/src/lib.rs} +101 -195
- package/sdk-core/client/src/metrics.rs +89 -0
- package/sdk-core/client/src/mocks.rs +167 -0
- package/sdk-core/{src/pollers → client/src}/retry.rs +172 -14
- package/sdk-core/core/Cargo.toml +96 -0
- package/sdk-core/{src → core/src}/core_tests/activity_tasks.rs +193 -37
- package/sdk-core/{src → core/src}/core_tests/child_workflows.rs +14 -14
- package/sdk-core/{src → core/src}/core_tests/determinism.rs +8 -8
- package/sdk-core/core/src/core_tests/local_activities.rs +328 -0
- package/sdk-core/{src → core/src}/core_tests/mod.rs +6 -9
- package/sdk-core/{src → core/src}/core_tests/queries.rs +54 -54
- package/sdk-core/{src → core/src}/core_tests/replay_flag.rs +8 -12
- package/sdk-core/{src → core/src}/core_tests/workers.rs +120 -33
- package/sdk-core/{src → core/src}/core_tests/workflow_cancels.rs +16 -26
- package/sdk-core/{src → core/src}/core_tests/workflow_tasks.rs +280 -292
- package/sdk-core/core/src/lib.rs +374 -0
- package/sdk-core/{src → core/src}/log_export.rs +3 -27
- package/sdk-core/core/src/pending_activations.rs +162 -0
- package/sdk-core/{src → core/src}/pollers/mod.rs +4 -22
- package/sdk-core/{src → core/src}/pollers/poll_buffer.rs +1 -1
- package/sdk-core/core/src/protosext/mod.rs +396 -0
- package/sdk-core/core/src/replay/mod.rs +210 -0
- package/sdk-core/core/src/retry_logic.rs +144 -0
- package/sdk-core/{src → core/src}/telemetry/metrics.rs +3 -58
- package/sdk-core/{src → core/src}/telemetry/mod.rs +8 -8
- package/sdk-core/{src → core/src}/telemetry/prometheus_server.rs +0 -0
- package/sdk-core/{src → core/src}/test_help/mod.rs +35 -83
- package/sdk-core/{src → core/src}/worker/activities/activity_heartbeat_manager.rs +95 -42
- package/sdk-core/core/src/worker/activities/local_activities.rs +973 -0
- package/sdk-core/{src → core/src}/worker/activities.rs +52 -33
- package/sdk-core/{src → core/src}/worker/dispatcher.rs +8 -6
- package/sdk-core/{src → core/src}/worker/mod.rs +347 -221
- package/sdk-core/core/src/worker/wft_delivery.rs +81 -0
- package/sdk-core/{src → core/src}/workflow/bridge.rs +5 -2
- package/sdk-core/{src → core/src}/workflow/driven_workflow.rs +17 -7
- package/sdk-core/{src → core/src}/workflow/history_update.rs +33 -7
- package/sdk-core/{src → core/src/workflow}/machines/activity_state_machine.rs +26 -26
- package/sdk-core/{src → core/src/workflow}/machines/cancel_external_state_machine.rs +8 -11
- package/sdk-core/{src → core/src/workflow}/machines/cancel_workflow_state_machine.rs +19 -21
- package/sdk-core/{src → core/src/workflow}/machines/child_workflow_state_machine.rs +20 -31
- package/sdk-core/{src → core/src/workflow}/machines/complete_workflow_state_machine.rs +3 -5
- package/sdk-core/{src → core/src/workflow}/machines/continue_as_new_workflow_state_machine.rs +18 -18
- package/sdk-core/{src → core/src/workflow}/machines/fail_workflow_state_machine.rs +5 -6
- package/sdk-core/core/src/workflow/machines/local_activity_state_machine.rs +1451 -0
- package/sdk-core/{src → core/src/workflow}/machines/mod.rs +54 -107
- package/sdk-core/{src → core/src/workflow}/machines/mutable_side_effect_state_machine.rs +0 -0
- package/sdk-core/{src → core/src/workflow}/machines/patch_state_machine.rs +29 -30
- package/sdk-core/{src → core/src/workflow}/machines/side_effect_state_machine.rs +0 -0
- package/sdk-core/{src → core/src/workflow}/machines/signal_external_state_machine.rs +17 -19
- package/sdk-core/{src → core/src/workflow}/machines/timer_state_machine.rs +20 -21
- package/sdk-core/{src → core/src/workflow}/machines/transition_coverage.rs +5 -2
- package/sdk-core/{src → core/src/workflow}/machines/upsert_search_attributes_state_machine.rs +0 -0
- package/sdk-core/core/src/workflow/machines/workflow_machines/local_acts.rs +96 -0
- package/sdk-core/{src → core/src/workflow}/machines/workflow_machines.rs +357 -171
- package/sdk-core/{src → core/src/workflow}/machines/workflow_task_state_machine.rs +1 -1
- package/sdk-core/{src → core/src}/workflow/mod.rs +200 -39
- package/sdk-core/{src → core/src}/workflow/workflow_tasks/cache_manager.rs +0 -0
- package/sdk-core/{src → core/src}/workflow/workflow_tasks/concurrency_manager.rs +38 -5
- package/sdk-core/{src → core/src}/workflow/workflow_tasks/mod.rs +317 -103
- package/sdk-core/{test_utils → core-api}/Cargo.toml +10 -7
- package/sdk-core/{src → core-api/src}/errors.rs +42 -92
- package/sdk-core/core-api/src/lib.rs +158 -0
- package/sdk-core/{src/worker/config.rs → core-api/src/worker.rs} +18 -23
- package/sdk-core/etc/deps.svg +156 -0
- package/sdk-core/fsm/rustfsm_procmacro/src/lib.rs +5 -5
- package/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/no_handle_conversions_require_into_fail.stderr +3 -5
- package/sdk-core/fsm/rustfsm_trait/src/lib.rs +7 -1
- package/sdk-core/histories/fail_wf_task.bin +0 -0
- package/sdk-core/histories/timer_workflow_history.bin +0 -0
- package/sdk-core/protos/api_upstream/temporal/api/command/v1/message.proto +44 -13
- package/sdk-core/protos/api_upstream/temporal/api/common/v1/message.proto +19 -1
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/common.proto +1 -1
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/failed_cause.proto +9 -0
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/namespace.proto +1 -0
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/reset.proto +1 -0
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/task_queue.proto +13 -0
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/workflow.proto +14 -7
- package/sdk-core/protos/api_upstream/temporal/api/history/v1/message.proto +176 -18
- package/sdk-core/protos/api_upstream/temporal/api/namespace/v1/message.proto +6 -0
- package/sdk-core/protos/api_upstream/temporal/api/query/v1/message.proto +11 -0
- package/sdk-core/protos/api_upstream/temporal/api/taskqueue/v1/message.proto +3 -0
- package/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto +156 -7
- package/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/service.proto +135 -104
- package/sdk-core/protos/local/temporal/sdk/core/activity_result/activity_result.proto +78 -0
- package/sdk-core/protos/local/temporal/sdk/core/activity_task/activity_task.proto +78 -0
- package/sdk-core/protos/local/temporal/sdk/core/bridge/bridge.proto +205 -0
- package/sdk-core/protos/local/temporal/sdk/core/bridge/service.proto +61 -0
- package/sdk-core/protos/local/{child_workflow.proto → temporal/sdk/core/child_workflow/child_workflow.proto} +1 -1
- package/sdk-core/protos/local/{common.proto → temporal/sdk/core/common/common.proto} +5 -3
- package/sdk-core/protos/local/{core_interface.proto → temporal/sdk/core/core_interface.proto} +10 -10
- package/sdk-core/protos/local/temporal/sdk/core/external_data/external_data.proto +30 -0
- package/sdk-core/protos/local/{workflow_activation.proto → temporal/sdk/core/workflow_activation/workflow_activation.proto} +35 -11
- package/sdk-core/protos/local/{workflow_commands.proto → temporal/sdk/core/workflow_commands/workflow_commands.proto} +55 -4
- package/sdk-core/protos/local/{workflow_completion.proto → temporal/sdk/core/workflow_completion/workflow_completion.proto} +3 -3
- package/sdk-core/sdk/Cargo.toml +32 -0
- package/sdk-core/{src/prototype_rust_sdk → sdk/src}/conversions.rs +0 -0
- package/sdk-core/sdk/src/lib.rs +699 -0
- package/sdk-core/sdk/src/payload_converter.rs +11 -0
- package/sdk-core/sdk/src/workflow_context/options.rs +180 -0
- package/sdk-core/{src/prototype_rust_sdk → sdk/src}/workflow_context.rs +201 -124
- package/sdk-core/{src/prototype_rust_sdk → sdk/src}/workflow_future.rs +63 -30
- package/sdk-core/sdk-core-protos/Cargo.toml +10 -0
- package/sdk-core/sdk-core-protos/build.rs +28 -6
- package/sdk-core/sdk-core-protos/src/constants.rs +7 -0
- package/sdk-core/{src/test_help → sdk-core-protos/src}/history_builder.rs +134 -49
- package/sdk-core/sdk-core-protos/src/history_info.rs +216 -0
- package/sdk-core/sdk-core-protos/src/lib.rs +601 -168
- package/sdk-core/sdk-core-protos/src/task_token.rs +38 -0
- package/sdk-core/sdk-core-protos/src/utilities.rs +14 -0
- package/sdk-core/test-utils/Cargo.toml +32 -0
- package/sdk-core/{src/test_help → test-utils/src}/canned_histories.rs +59 -78
- package/sdk-core/test-utils/src/histfetch.rs +28 -0
- package/sdk-core/{test_utils → test-utils}/src/lib.rs +131 -68
- package/sdk-core/tests/integ_tests/client_tests.rs +1 -1
- package/sdk-core/tests/integ_tests/heartbeat_tests.rs +11 -7
- package/sdk-core/tests/integ_tests/polling_tests.rs +12 -11
- package/sdk-core/tests/integ_tests/queries_tests.rs +82 -78
- package/sdk-core/tests/integ_tests/workflow_tests/activities.rs +91 -71
- package/sdk-core/tests/integ_tests/workflow_tests/cancel_external.rs +3 -4
- package/sdk-core/tests/integ_tests/workflow_tests/cancel_wf.rs +2 -4
- package/sdk-core/tests/integ_tests/workflow_tests/child_workflows.rs +4 -6
- package/sdk-core/tests/integ_tests/workflow_tests/continue_as_new.rs +4 -6
- package/sdk-core/tests/integ_tests/workflow_tests/determinism.rs +3 -4
- package/sdk-core/tests/integ_tests/workflow_tests/local_activities.rs +496 -0
- package/sdk-core/tests/integ_tests/workflow_tests/patches.rs +5 -8
- package/sdk-core/tests/integ_tests/workflow_tests/replay.rs +125 -0
- package/sdk-core/tests/integ_tests/workflow_tests/signals.rs +7 -13
- package/sdk-core/tests/integ_tests/workflow_tests/stickyness.rs +33 -5
- package/sdk-core/tests/integ_tests/workflow_tests/timers.rs +12 -16
- package/sdk-core/tests/integ_tests/workflow_tests.rs +85 -82
- package/sdk-core/tests/load_tests.rs +6 -6
- package/sdk-core/tests/main.rs +2 -2
- package/src/conversions.rs +24 -21
- package/src/errors.rs +8 -0
- package/src/lib.rs +323 -211
- package/sdk-core/protos/local/activity_result.proto +0 -46
- package/sdk-core/protos/local/activity_task.proto +0 -66
- package/sdk-core/src/core_tests/retry.rs +0 -147
- package/sdk-core/src/lib.rs +0 -403
- package/sdk-core/src/machines/local_activity_state_machine.rs +0 -117
- package/sdk-core/src/pending_activations.rs +0 -249
- package/sdk-core/src/protosext/mod.rs +0 -160
- package/sdk-core/src/prototype_rust_sdk.rs +0 -412
- package/sdk-core/src/task_token.rs +0 -20
- package/sdk-core/src/test_help/history_info.rs +0 -157
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
use crate::temporal::api::{
|
|
2
|
+
common::v1::WorkflowType,
|
|
3
|
+
enums::v1::{EventType, TaskQueueKind},
|
|
4
|
+
history::v1::{history_event, History, HistoryEvent},
|
|
5
|
+
taskqueue::v1::TaskQueue,
|
|
6
|
+
workflowservice::v1::PollWorkflowTaskQueueResponse,
|
|
7
|
+
};
|
|
8
|
+
use anyhow::{anyhow, bail};
|
|
9
|
+
use rand::{thread_rng, Rng};
|
|
10
|
+
|
|
11
|
+
/// Contains information about a validated history. Used for replay and other testing.
|
|
12
|
+
#[derive(Clone, Debug, PartialEq)]
|
|
13
|
+
pub struct HistoryInfo {
|
|
14
|
+
previous_started_event_id: i64,
|
|
15
|
+
workflow_task_started_event_id: i64,
|
|
16
|
+
// This needs to stay private so the struct can't be instantiated outside of the constructor,
|
|
17
|
+
// which enforces some invariants regarding history structure that need to be upheld.
|
|
18
|
+
events: Vec<HistoryEvent>,
|
|
19
|
+
wf_task_count: usize,
|
|
20
|
+
wf_type: String,
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
type Result<T, E = anyhow::Error> = std::result::Result<T, E>;
|
|
24
|
+
|
|
25
|
+
impl HistoryInfo {
|
|
26
|
+
/// Constructs a new instance, retaining only enough events to reach the provided workflow
|
|
27
|
+
/// task number. If not provided, all events are retained.
|
|
28
|
+
pub fn new_from_history(h: &History, to_wf_task_num: Option<usize>) -> Result<Self> {
|
|
29
|
+
let events = &h.events;
|
|
30
|
+
if events.is_empty() {
|
|
31
|
+
bail!("History is empty!");
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
let is_all_hist = to_wf_task_num.is_none();
|
|
35
|
+
let to_wf_task_num = to_wf_task_num.unwrap_or(usize::MAX);
|
|
36
|
+
let mut workflow_task_started_event_id = 0;
|
|
37
|
+
let mut wf_task_count = 0;
|
|
38
|
+
let mut history = events.iter().peekable();
|
|
39
|
+
|
|
40
|
+
let wf_type = match &events.get(0).unwrap().attributes {
|
|
41
|
+
Some(history_event::Attributes::WorkflowExecutionStartedEventAttributes(attrs)) => {
|
|
42
|
+
attrs
|
|
43
|
+
.workflow_type
|
|
44
|
+
.as_ref()
|
|
45
|
+
.ok_or(anyhow!(
|
|
46
|
+
"No workflow type defined in execution started attributes"
|
|
47
|
+
))?
|
|
48
|
+
.name
|
|
49
|
+
.clone()
|
|
50
|
+
}
|
|
51
|
+
_ => bail!("First event in history was not workflow execution started!"),
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
let mut events = vec![];
|
|
55
|
+
while let Some(event) = history.next() {
|
|
56
|
+
events.push(event.clone());
|
|
57
|
+
let next_event = history.peek();
|
|
58
|
+
|
|
59
|
+
if event.event_type == EventType::WorkflowTaskStarted as i32 {
|
|
60
|
+
let next_is_completed = next_event.map_or(false, |ne| {
|
|
61
|
+
ne.event_type == EventType::WorkflowTaskCompleted as i32
|
|
62
|
+
});
|
|
63
|
+
let next_is_failed_or_timeout = next_event.map_or(false, |ne| {
|
|
64
|
+
ne.event_type == EventType::WorkflowTaskFailed as i32
|
|
65
|
+
|| ne.event_type == EventType::WorkflowTaskTimedOut as i32
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
if next_event.is_none() || next_is_completed {
|
|
69
|
+
let previous_started_event_id = workflow_task_started_event_id;
|
|
70
|
+
workflow_task_started_event_id = event.event_id;
|
|
71
|
+
if workflow_task_started_event_id == previous_started_event_id {
|
|
72
|
+
bail!(
|
|
73
|
+
"Latest wf started id {workflow_task_started_event_id} and previous \
|
|
74
|
+
one {previous_started_event_id} are equal!"
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
wf_task_count += 1;
|
|
78
|
+
if wf_task_count == to_wf_task_num || next_event.is_none() {
|
|
79
|
+
return Ok(Self {
|
|
80
|
+
previous_started_event_id,
|
|
81
|
+
workflow_task_started_event_id,
|
|
82
|
+
events,
|
|
83
|
+
wf_task_count,
|
|
84
|
+
wf_type,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
} else if next_event.is_some() && !next_is_failed_or_timeout {
|
|
88
|
+
bail!(
|
|
89
|
+
"Invalid history! Event {event:?} should be WFT \
|
|
90
|
+
completed, failed, or timed out"
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if next_event.is_none() {
|
|
96
|
+
if event.is_final_wf_execution_event() || is_all_hist {
|
|
97
|
+
// Since this is the end of execution, we are pretending that the SDK is
|
|
98
|
+
// replaying *complete* history, which would mean the previously started ID is
|
|
99
|
+
// in fact the last task.
|
|
100
|
+
return Ok(Self {
|
|
101
|
+
previous_started_event_id: workflow_task_started_event_id,
|
|
102
|
+
workflow_task_started_event_id,
|
|
103
|
+
events,
|
|
104
|
+
wf_task_count,
|
|
105
|
+
wf_type,
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
// No more events
|
|
109
|
+
if workflow_task_started_event_id != event.event_id {
|
|
110
|
+
bail!("History ends unexpectedly");
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
unreachable!()
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/// Remove events from the beginning of this history such that it looks like what would've been
|
|
118
|
+
/// delivered on a sticky queue where the previously started task was the one before the last
|
|
119
|
+
/// task in this history.
|
|
120
|
+
pub fn make_incremental(&mut self) {
|
|
121
|
+
let last_complete_ix = self
|
|
122
|
+
.events
|
|
123
|
+
.iter()
|
|
124
|
+
.rposition(|he| he.event_type() == EventType::WorkflowTaskCompleted)
|
|
125
|
+
.expect("Must be a WFT completed event in history");
|
|
126
|
+
self.events.drain(0..=last_complete_ix);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
pub fn events(&self) -> &[HistoryEvent] {
|
|
130
|
+
&self.events
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/// Attempt to extract run id from internal events. If the first event is not workflow execution
|
|
134
|
+
/// started, it will panic.
|
|
135
|
+
pub fn orig_run_id(&self) -> &str {
|
|
136
|
+
if let Some(history_event::Attributes::WorkflowExecutionStartedEventAttributes(wes)) =
|
|
137
|
+
&self.events[0].attributes
|
|
138
|
+
{
|
|
139
|
+
&wes.original_execution_run_id
|
|
140
|
+
} else {
|
|
141
|
+
panic!("First event is wrong type")
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/// Return total workflow task count in this history
|
|
146
|
+
pub const fn wf_task_count(&self) -> usize {
|
|
147
|
+
self.wf_task_count
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/// Create a workflow task polling response containing all the events in this history and a
|
|
151
|
+
/// randomly generated task token. Caller should attach a meaningful `workflow_execution` if
|
|
152
|
+
/// needed.
|
|
153
|
+
pub fn as_poll_wft_response(&self, task_q: impl Into<String>) -> PollWorkflowTaskQueueResponse {
|
|
154
|
+
let task_token: [u8; 16] = thread_rng().gen();
|
|
155
|
+
PollWorkflowTaskQueueResponse {
|
|
156
|
+
history: Some(History {
|
|
157
|
+
events: self.events.clone(),
|
|
158
|
+
}),
|
|
159
|
+
task_token: task_token.to_vec(),
|
|
160
|
+
workflow_type: Some(WorkflowType {
|
|
161
|
+
name: self.wf_type.clone(),
|
|
162
|
+
}),
|
|
163
|
+
workflow_execution_task_queue: Some(TaskQueue {
|
|
164
|
+
name: task_q.into(),
|
|
165
|
+
kind: TaskQueueKind::Normal as i32,
|
|
166
|
+
}),
|
|
167
|
+
previous_started_event_id: self.previous_started_event_id,
|
|
168
|
+
started_event_id: self.workflow_task_started_event_id,
|
|
169
|
+
..Default::default()
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/// Returns the last workflow task started event id
|
|
174
|
+
pub fn previous_started_event_id(&self) -> i64 {
|
|
175
|
+
self.previous_started_event_id
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
impl From<HistoryInfo> for History {
|
|
180
|
+
fn from(i: HistoryInfo) -> Self {
|
|
181
|
+
Self { events: i.events }
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
#[cfg(test)]
|
|
186
|
+
mod tests {
|
|
187
|
+
use crate::{temporal::api::enums::v1::EventType, TestHistoryBuilder};
|
|
188
|
+
|
|
189
|
+
fn single_timer(timer_id: &str) -> TestHistoryBuilder {
|
|
190
|
+
let mut t = TestHistoryBuilder::default();
|
|
191
|
+
t.add_by_type(EventType::WorkflowExecutionStarted);
|
|
192
|
+
t.add_full_wf_task();
|
|
193
|
+
let timer_started_event_id = t.add_get_event_id(EventType::TimerStarted, None);
|
|
194
|
+
t.add_timer_fired(timer_started_event_id, timer_id.to_string());
|
|
195
|
+
t.add_workflow_task_scheduled_and_started();
|
|
196
|
+
t
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
#[test]
|
|
200
|
+
fn history_info_constructs_properly() {
|
|
201
|
+
let t = single_timer("timer1");
|
|
202
|
+
|
|
203
|
+
let history_info = t.get_history_info(1).unwrap();
|
|
204
|
+
assert_eq!(3, history_info.events().len());
|
|
205
|
+
let history_info = t.get_history_info(2).unwrap();
|
|
206
|
+
assert_eq!(8, history_info.events().len());
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
#[test]
|
|
210
|
+
fn incremental_works() {
|
|
211
|
+
let t = single_timer("timer1");
|
|
212
|
+
let hi = t.get_one_wft(2).unwrap();
|
|
213
|
+
assert_eq!(hi.events().len(), 4);
|
|
214
|
+
assert_eq!(hi.events()[0].event_id, 5);
|
|
215
|
+
}
|
|
216
|
+
}
|