@temporalio/core-bridge 1.9.2 → 1.10.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 +754 -473
- package/Cargo.toml +3 -3
- package/lib/index.d.ts +33 -2
- package/lib/index.js.map +1 -1
- package/package.json +4 -4
- package/releases/aarch64-apple-darwin/index.node +0 -0
- package/releases/aarch64-unknown-linux-gnu/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 +4 -3
- package/sdk-core/.cargo/config.toml +2 -4
- package/sdk-core/.github/workflows/heavy.yml +1 -1
- package/sdk-core/.github/workflows/per-pr.yml +6 -4
- package/sdk-core/Cargo.toml +10 -3
- package/sdk-core/README.md +4 -6
- package/sdk-core/client/Cargo.toml +13 -5
- package/sdk-core/client/src/lib.rs +123 -34
- package/sdk-core/client/src/metrics.rs +70 -18
- package/sdk-core/client/src/proxy.rs +85 -0
- package/sdk-core/client/src/raw.rs +67 -5
- package/sdk-core/client/src/worker_registry/mod.rs +5 -3
- package/sdk-core/client/src/workflow_handle/mod.rs +3 -1
- package/sdk-core/core/Cargo.toml +31 -37
- package/sdk-core/core/src/abstractions/take_cell.rs +3 -3
- package/sdk-core/core/src/abstractions.rs +176 -108
- package/sdk-core/core/src/core_tests/activity_tasks.rs +4 -13
- package/sdk-core/core/src/core_tests/determinism.rs +2 -1
- package/sdk-core/core/src/core_tests/local_activities.rs +3 -3
- package/sdk-core/core/src/core_tests/mod.rs +3 -3
- package/sdk-core/core/src/core_tests/queries.rs +42 -5
- package/sdk-core/core/src/core_tests/workers.rs +2 -3
- package/sdk-core/core/src/core_tests/workflow_tasks.rs +115 -15
- package/sdk-core/core/src/ephemeral_server/mod.rs +109 -136
- package/sdk-core/core/src/internal_flags.rs +8 -8
- package/sdk-core/core/src/lib.rs +16 -11
- package/sdk-core/core/src/pollers/mod.rs +11 -5
- package/sdk-core/core/src/pollers/poll_buffer.rs +48 -29
- package/sdk-core/core/src/protosext/mod.rs +32 -32
- package/sdk-core/core/src/protosext/protocol_messages.rs +14 -24
- package/sdk-core/core/src/retry_logic.rs +2 -2
- package/sdk-core/core/src/telemetry/log_export.rs +10 -9
- package/sdk-core/core/src/telemetry/metrics.rs +233 -330
- package/sdk-core/core/src/telemetry/mod.rs +11 -38
- package/sdk-core/core/src/telemetry/otel.rs +355 -0
- package/sdk-core/core/src/telemetry/prometheus_server.rs +36 -23
- package/sdk-core/core/src/test_help/mod.rs +80 -59
- package/sdk-core/core/src/worker/activities/activity_heartbeat_manager.rs +6 -6
- package/sdk-core/core/src/worker/activities/local_activities.rs +46 -43
- package/sdk-core/core/src/worker/activities.rs +45 -46
- package/sdk-core/core/src/worker/client/mocks.rs +8 -7
- package/sdk-core/core/src/worker/client.rs +40 -39
- package/sdk-core/core/src/worker/mod.rs +72 -42
- package/sdk-core/core/src/worker/slot_provider.rs +28 -28
- package/sdk-core/core/src/worker/slot_supplier.rs +1 -0
- package/sdk-core/core/src/worker/tuner/fixed_size.rs +52 -0
- package/sdk-core/core/src/worker/tuner/resource_based.rs +561 -0
- package/sdk-core/core/src/worker/tuner.rs +122 -0
- package/sdk-core/core/src/worker/workflow/driven_workflow.rs +6 -6
- package/sdk-core/core/src/worker/workflow/history_update.rs +27 -53
- package/sdk-core/core/src/worker/workflow/machines/activity_state_machine.rs +4 -17
- package/sdk-core/core/src/worker/workflow/machines/cancel_external_state_machine.rs +1 -10
- package/sdk-core/core/src/worker/workflow/machines/cancel_workflow_state_machine.rs +4 -11
- package/sdk-core/core/src/worker/workflow/machines/child_workflow_state_machine.rs +17 -35
- package/sdk-core/core/src/worker/workflow/machines/complete_workflow_state_machine.rs +0 -8
- package/sdk-core/core/src/worker/workflow/machines/continue_as_new_workflow_state_machine.rs +1 -5
- package/sdk-core/core/src/worker/workflow/machines/fail_workflow_state_machine.rs +0 -5
- package/sdk-core/core/src/worker/workflow/machines/local_activity_state_machine.rs +0 -5
- package/sdk-core/core/src/worker/workflow/machines/mod.rs +0 -14
- package/sdk-core/core/src/worker/workflow/machines/modify_workflow_properties_state_machine.rs +0 -5
- package/sdk-core/core/src/worker/workflow/machines/patch_state_machine.rs +0 -5
- package/sdk-core/core/src/worker/workflow/machines/signal_external_state_machine.rs +1 -10
- package/sdk-core/core/src/worker/workflow/machines/timer_state_machine.rs +3 -10
- package/sdk-core/core/src/worker/workflow/machines/transition_coverage.rs +12 -8
- package/sdk-core/core/src/worker/workflow/machines/update_state_machine.rs +0 -10
- package/sdk-core/core/src/worker/workflow/machines/upsert_search_attributes_state_machine.rs +6 -13
- package/sdk-core/core/src/worker/workflow/machines/workflow_machines.rs +27 -37
- package/sdk-core/core/src/worker/workflow/machines/workflow_task_state_machine.rs +3 -14
- package/sdk-core/core/src/worker/workflow/managed_run.rs +84 -54
- package/sdk-core/core/src/worker/workflow/mod.rs +63 -160
- package/sdk-core/core/src/worker/workflow/run_cache.rs +22 -13
- package/sdk-core/core/src/worker/workflow/wft_extraction.rs +16 -3
- package/sdk-core/core/src/worker/workflow/wft_poller.rs +15 -12
- package/sdk-core/core/src/worker/workflow/workflow_stream.rs +39 -78
- package/sdk-core/core-api/Cargo.toml +6 -5
- package/sdk-core/core-api/src/errors.rs +8 -0
- package/sdk-core/core-api/src/telemetry/metrics.rs +75 -4
- package/sdk-core/core-api/src/telemetry.rs +7 -1
- package/sdk-core/core-api/src/worker.rs +212 -56
- package/sdk-core/fsm/Cargo.toml +3 -0
- package/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/no_handle_conversions_require_into_fail.stderr +1 -1
- package/sdk-core/sdk/Cargo.toml +5 -7
- package/sdk-core/sdk/src/app_data.rs +3 -3
- package/sdk-core/sdk/src/lib.rs +5 -3
- package/sdk-core/sdk/src/workflow_context/options.rs +1 -1
- package/sdk-core/sdk/src/workflow_context.rs +10 -9
- package/sdk-core/sdk/src/workflow_future.rs +1 -1
- package/sdk-core/sdk-core-protos/Cargo.toml +8 -6
- package/sdk-core/sdk-core-protos/build.rs +1 -10
- package/sdk-core/sdk-core-protos/protos/api_upstream/.github/PULL_REQUEST_TEMPLATE.md +3 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/.github/workflows/ci.yml +26 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/Makefile +42 -20
- package/sdk-core/sdk-core-protos/protos/api_upstream/README.md +2 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/api-linter.yaml +36 -26
- package/sdk-core/sdk-core-protos/protos/api_upstream/buf.lock +2 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/google/protobuf/struct.proto +95 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/openapi/openapiv2.json +9632 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/openapi/openapiv3.yaml +7337 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/openapi/payload_description.txt +2 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/command/v1/message.proto +45 -11
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/common/v1/message.proto +22 -4
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/enums/v1/command_type.proto +2 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/enums/v1/common.proto +44 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/enums/v1/event_type.proto +18 -3
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/enums/v1/failed_cause.proto +20 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/enums/v1/task_queue.proto +30 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/enums/v1/update.proto +7 -8
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/enums/v1/workflow.proto +23 -5
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/errordetails/v1/message.proto +20 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/failure/v1/message.proto +25 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/history/v1/message.proto +141 -15
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/namespace/v1/message.proto +12 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/nexus/v1/message.proto +193 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/operatorservice/v1/request_response.proto +73 -6
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/operatorservice/v1/service.proto +46 -4
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/schedule/v1/message.proto +4 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/sdk/v1/workflow_metadata.proto +2 -2
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/taskqueue/v1/message.proto +116 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/workflow/v1/message.proto +134 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto +274 -29
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/workflowservice/v1/service.proto +57 -1
- package/sdk-core/sdk-core-protos/protos/local/temporal/sdk/core/workflow_activation/workflow_activation.proto +10 -12
- package/sdk-core/sdk-core-protos/src/history_builder.rs +1 -1
- package/sdk-core/sdk-core-protos/src/lib.rs +54 -51
- package/sdk-core/sdk-core-protos/src/task_token.rs +11 -2
- package/sdk-core/test-utils/Cargo.toml +7 -4
- package/sdk-core/test-utils/src/histfetch.rs +1 -1
- package/sdk-core/test-utils/src/lib.rs +44 -62
- package/sdk-core/tests/fuzzy_workflow.rs +5 -2
- package/sdk-core/tests/heavy_tests.rs +114 -17
- package/sdk-core/tests/integ_tests/activity_functions.rs +1 -1
- package/sdk-core/tests/integ_tests/client_tests.rs +2 -2
- package/sdk-core/tests/integ_tests/ephemeral_server_tests.rs +38 -26
- package/sdk-core/tests/integ_tests/metrics_tests.rs +126 -17
- package/sdk-core/tests/integ_tests/polling_tests.rs +118 -2
- package/sdk-core/tests/integ_tests/update_tests.rs +3 -5
- package/sdk-core/tests/integ_tests/visibility_tests.rs +3 -3
- package/sdk-core/tests/integ_tests/workflow_tests/activities.rs +1 -1
- package/sdk-core/tests/integ_tests/workflow_tests/appdata_propagation.rs +1 -1
- package/sdk-core/tests/integ_tests/workflow_tests/cancel_external.rs +1 -1
- package/sdk-core/tests/integ_tests/workflow_tests/cancel_wf.rs +1 -1
- package/sdk-core/tests/integ_tests/workflow_tests/child_workflows.rs +3 -3
- package/sdk-core/tests/integ_tests/workflow_tests/continue_as_new.rs +5 -4
- package/sdk-core/tests/integ_tests/workflow_tests/determinism.rs +3 -2
- package/sdk-core/tests/integ_tests/workflow_tests/eager.rs +6 -10
- package/sdk-core/tests/integ_tests/workflow_tests/local_activities.rs +9 -7
- package/sdk-core/tests/integ_tests/workflow_tests/modify_wf_properties.rs +1 -1
- package/sdk-core/tests/integ_tests/workflow_tests/patches.rs +14 -9
- package/sdk-core/tests/integ_tests/workflow_tests/resets.rs +1 -1
- package/sdk-core/tests/integ_tests/workflow_tests/signals.rs +6 -13
- package/sdk-core/tests/integ_tests/workflow_tests/stickyness.rs +9 -6
- package/sdk-core/tests/integ_tests/workflow_tests/timers.rs +5 -5
- package/sdk-core/tests/integ_tests/workflow_tests/upsert_search_attrs.rs +1 -1
- package/sdk-core/tests/integ_tests/workflow_tests.rs +115 -11
- package/sdk-core/tests/main.rs +2 -2
- package/src/conversions.rs +57 -0
- package/src/lib.rs +1 -0
- package/src/runtime.rs +51 -35
- package/ts/index.ts +67 -3
- package/sdk-core/core/src/worker/workflow/workflow_stream/saved_wf_inputs.rs +0 -117
- package/sdk-core/core/src/worker/workflow/workflow_stream/tonic_status_serde.rs +0 -24
- package/sdk-core/sdk/src/payload_converter.rs +0 -11
- package/sdk-core/sdk-core-protos/protos/api_upstream/.buildkite/Dockerfile +0 -2
- package/sdk-core/sdk-core-protos/protos/api_upstream/.buildkite/docker-compose.yml +0 -15
- package/sdk-core/sdk-core-protos/protos/api_upstream/.buildkite/pipeline.yml +0 -10
- package/sdk-core/test-utils/src/wf_input_saver.rs +0 -50
- package/sdk-core/tests/wf_input_replay.rs +0 -32
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
use assert_matches::assert_matches;
|
|
2
|
-
use std::time::Duration;
|
|
2
|
+
use std::{sync::Arc, time::Duration};
|
|
3
|
+
use temporal_client::{WfClientExt, WorkflowClientTrait, WorkflowOptions};
|
|
4
|
+
use temporal_sdk_core::{
|
|
5
|
+
ephemeral_server::TemporalDevServerConfigBuilder, init_worker, ClientOptionsBuilder,
|
|
6
|
+
};
|
|
7
|
+
use temporal_sdk_core_api::Worker;
|
|
3
8
|
use temporal_sdk_core_protos::coresdk::{
|
|
4
9
|
activity_task::activity_task as act_task,
|
|
5
10
|
workflow_activation::{workflow_activation_job, FireTimer, WorkflowActivationJob},
|
|
@@ -8,9 +13,12 @@ use temporal_sdk_core_protos::coresdk::{
|
|
|
8
13
|
IntoCompletion,
|
|
9
14
|
};
|
|
10
15
|
use temporal_sdk_core_test_utils::{
|
|
11
|
-
|
|
16
|
+
default_cached_download, drain_pollers_and_shutdown, init_core_and_create_wf, init_integ_telem,
|
|
17
|
+
integ_worker_config, schedule_activity_cmd, WorkerTestHelpers,
|
|
12
18
|
};
|
|
13
19
|
use tokio::time::timeout;
|
|
20
|
+
use tracing::info;
|
|
21
|
+
use url::Url;
|
|
14
22
|
|
|
15
23
|
#[tokio::test]
|
|
16
24
|
async fn out_of_order_completion_doesnt_hang() {
|
|
@@ -88,3 +96,111 @@ async fn out_of_order_completion_doesnt_hang() {
|
|
|
88
96
|
|
|
89
97
|
jh.await.unwrap();
|
|
90
98
|
}
|
|
99
|
+
|
|
100
|
+
#[tokio::test]
|
|
101
|
+
async fn switching_worker_client_changes_poll() {
|
|
102
|
+
// Start two servers
|
|
103
|
+
info!("Starting servers");
|
|
104
|
+
let server_config = TemporalDevServerConfigBuilder::default()
|
|
105
|
+
.exe(default_cached_download())
|
|
106
|
+
// We need to lower the poll timeout so the poll call rolls over
|
|
107
|
+
.extra_args(vec![
|
|
108
|
+
"--dynamic-config-value".to_string(),
|
|
109
|
+
"matching.longPollExpirationInterval=\"1s\"".to_string(),
|
|
110
|
+
])
|
|
111
|
+
.build()
|
|
112
|
+
.unwrap();
|
|
113
|
+
let mut server1 = server_config.start_server().await.unwrap();
|
|
114
|
+
let mut server2 = server_config.start_server().await.unwrap();
|
|
115
|
+
|
|
116
|
+
// Connect clients to both servers
|
|
117
|
+
info!("Connecting clients");
|
|
118
|
+
let mut client_common_config = ClientOptionsBuilder::default();
|
|
119
|
+
client_common_config
|
|
120
|
+
.identity("integ_tester".to_owned())
|
|
121
|
+
.client_name("temporal-core".to_owned())
|
|
122
|
+
.client_version("0.1.0".to_owned());
|
|
123
|
+
let client1 = client_common_config
|
|
124
|
+
.clone()
|
|
125
|
+
.target_url(Url::parse(&format!("http://{}", server1.target)).unwrap())
|
|
126
|
+
.build()
|
|
127
|
+
.unwrap()
|
|
128
|
+
.connect("default", None)
|
|
129
|
+
.await
|
|
130
|
+
.unwrap();
|
|
131
|
+
let client2 = client_common_config
|
|
132
|
+
.clone()
|
|
133
|
+
.target_url(Url::parse(&format!("http://{}", server2.target)).unwrap())
|
|
134
|
+
.build()
|
|
135
|
+
.unwrap()
|
|
136
|
+
.connect("default", None)
|
|
137
|
+
.await
|
|
138
|
+
.unwrap();
|
|
139
|
+
|
|
140
|
+
// Start a workflow on both servers
|
|
141
|
+
info!("Starting workflows");
|
|
142
|
+
let wf1 = client1
|
|
143
|
+
.start_workflow(
|
|
144
|
+
vec![],
|
|
145
|
+
"my-task-queue".to_owned(),
|
|
146
|
+
"my-workflow-1".to_owned(),
|
|
147
|
+
"my-workflow-type".to_owned(),
|
|
148
|
+
None,
|
|
149
|
+
WorkflowOptions::default(),
|
|
150
|
+
)
|
|
151
|
+
.await
|
|
152
|
+
.unwrap();
|
|
153
|
+
let wf2 = client2
|
|
154
|
+
.start_workflow(
|
|
155
|
+
vec![],
|
|
156
|
+
"my-task-queue".to_owned(),
|
|
157
|
+
"my-workflow-2".to_owned(),
|
|
158
|
+
"my-workflow-type".to_owned(),
|
|
159
|
+
None,
|
|
160
|
+
WorkflowOptions::default(),
|
|
161
|
+
)
|
|
162
|
+
.await
|
|
163
|
+
.unwrap();
|
|
164
|
+
|
|
165
|
+
// Create a worker only on the first server
|
|
166
|
+
let worker = init_worker(
|
|
167
|
+
init_integ_telem(),
|
|
168
|
+
integ_worker_config("my-task-queue")
|
|
169
|
+
// We want a cache so we don't get extra remove-job activations
|
|
170
|
+
.max_cached_workflows(100_usize)
|
|
171
|
+
.build()
|
|
172
|
+
.unwrap(),
|
|
173
|
+
client1.clone(),
|
|
174
|
+
)
|
|
175
|
+
.unwrap();
|
|
176
|
+
|
|
177
|
+
// Poll for first task, confirm it's first wf, complete, and wait for complete
|
|
178
|
+
info!("Doing initial poll");
|
|
179
|
+
let act1 = worker.poll_workflow_activation().await.unwrap();
|
|
180
|
+
assert_eq!(wf1.run_id, act1.run_id);
|
|
181
|
+
worker.complete_execution(&act1.run_id).await;
|
|
182
|
+
info!("Waiting on first workflow complete");
|
|
183
|
+
client1
|
|
184
|
+
.get_untyped_workflow_handle("my-workflow-1", wf1.run_id)
|
|
185
|
+
.get_workflow_result(Default::default())
|
|
186
|
+
.await
|
|
187
|
+
.unwrap();
|
|
188
|
+
|
|
189
|
+
// Swap client, poll for next task, confirm it's second wf, and respond w/ empty
|
|
190
|
+
info!("Replacing client and polling again");
|
|
191
|
+
worker.replace_client(client2.get_client().inner().clone());
|
|
192
|
+
let act2 = worker.poll_workflow_activation().await.unwrap();
|
|
193
|
+
assert_eq!(wf2.run_id, act2.run_id);
|
|
194
|
+
worker.complete_execution(&act2.run_id).await;
|
|
195
|
+
info!("Waiting on second workflow complete");
|
|
196
|
+
client2
|
|
197
|
+
.get_untyped_workflow_handle("my-workflow-2", wf2.run_id)
|
|
198
|
+
.get_workflow_result(Default::default())
|
|
199
|
+
.await
|
|
200
|
+
.unwrap();
|
|
201
|
+
|
|
202
|
+
// Shutdown workers and servers
|
|
203
|
+
drain_pollers_and_shutdown(&(Arc::new(worker) as Arc<dyn Worker>)).await;
|
|
204
|
+
server1.shutdown().await.unwrap();
|
|
205
|
+
server2.shutdown().await.unwrap();
|
|
206
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
use anyhow::{anyhow, bail};
|
|
2
2
|
use assert_matches::assert_matches;
|
|
3
3
|
use futures_util::{future, future::join_all, StreamExt};
|
|
4
|
-
use
|
|
4
|
+
use once_cell::sync::Lazy;
|
|
5
5
|
use std::{
|
|
6
6
|
sync::atomic::{AtomicBool, AtomicUsize, Ordering},
|
|
7
7
|
time::Duration,
|
|
@@ -664,7 +664,7 @@ async fn update_timer_sequence() {
|
|
|
664
664
|
Ok("done")
|
|
665
665
|
},
|
|
666
666
|
);
|
|
667
|
-
ctx.timer(Duration::from_secs(
|
|
667
|
+
ctx.timer(Duration::from_secs(2)).await;
|
|
668
668
|
Ok(().into())
|
|
669
669
|
});
|
|
670
670
|
|
|
@@ -817,9 +817,7 @@ async fn worker_restarted_in_middle_of_update() {
|
|
|
817
817
|
let mut worker = starter.worker().await;
|
|
818
818
|
let client = starter.get_client().await;
|
|
819
819
|
|
|
820
|
-
|
|
821
|
-
static ref BARR: Barrier = Barrier::new(2);
|
|
822
|
-
}
|
|
820
|
+
static BARR: Lazy<Barrier> = Lazy::new(|| Barrier::new(2));
|
|
823
821
|
static ACT_RAN: AtomicBool = AtomicBool::new(false);
|
|
824
822
|
worker.register_wf(wf_name.to_owned(), |ctx: WfContext| async move {
|
|
825
823
|
ctx.update_handler(
|
|
@@ -91,13 +91,13 @@ async fn client_list_open_closed_workflow_executions() {
|
|
|
91
91
|
async fn client_create_namespace() {
|
|
92
92
|
let client = Arc::new(
|
|
93
93
|
get_integ_server_options()
|
|
94
|
-
.connect(NAMESPACE.to_owned(), None
|
|
94
|
+
.connect(NAMESPACE.to_owned(), None)
|
|
95
95
|
.await
|
|
96
96
|
.expect("Must connect"),
|
|
97
97
|
);
|
|
98
98
|
|
|
99
99
|
let register_options = RegisterNamespaceOptions::builder()
|
|
100
|
-
.namespace(
|
|
100
|
+
.namespace(uuid::Uuid::new_v4().to_string())
|
|
101
101
|
.description("it's alive")
|
|
102
102
|
.build()
|
|
103
103
|
.unwrap();
|
|
@@ -138,7 +138,7 @@ async fn client_create_namespace() {
|
|
|
138
138
|
async fn client_describe_namespace() {
|
|
139
139
|
let client = Arc::new(
|
|
140
140
|
get_integ_server_options()
|
|
141
|
-
.connect(NAMESPACE.to_owned(), None
|
|
141
|
+
.connect(NAMESPACE.to_owned(), None)
|
|
142
142
|
.await
|
|
143
143
|
.expect("Must connect"),
|
|
144
144
|
);
|
|
@@ -40,7 +40,7 @@ use temporal_sdk_core_test_utils::{
|
|
|
40
40
|
};
|
|
41
41
|
use tokio::{join, sync::Semaphore, time::sleep};
|
|
42
42
|
|
|
43
|
-
pub async fn one_activity_wf(ctx: WfContext) -> WorkflowResult<()> {
|
|
43
|
+
pub(crate) async fn one_activity_wf(ctx: WfContext) -> WorkflowResult<()> {
|
|
44
44
|
ctx.activity(ActivityOptions {
|
|
45
45
|
activity_type: "echo_activity".to_string(),
|
|
46
46
|
start_to_close_timeout: Some(Duration::from_secs(5)),
|
|
@@ -11,7 +11,7 @@ struct Data {
|
|
|
11
11
|
message: String,
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
pub async fn appdata_activity_wf(ctx: WfContext) -> WorkflowResult<()> {
|
|
14
|
+
pub(crate) async fn appdata_activity_wf(ctx: WfContext) -> WorkflowResult<()> {
|
|
15
15
|
ctx.activity(ActivityOptions {
|
|
16
16
|
activity_type: "echo_activity".to_string(),
|
|
17
17
|
start_to_close_timeout: Some(Duration::from_secs(5)),
|
|
@@ -33,7 +33,7 @@ async fn cancel_receiver(ctx: WfContext) -> WorkflowResult<()> {
|
|
|
33
33
|
#[tokio::test]
|
|
34
34
|
async fn sends_cancel_to_other_wf() {
|
|
35
35
|
let mut starter = CoreWfStarter::new("sends_cancel_to_other_wf");
|
|
36
|
-
starter.no_remote_activities();
|
|
36
|
+
starter.worker_config.no_remote_activities(true);
|
|
37
37
|
let mut worker = starter.worker().await;
|
|
38
38
|
worker.register_wf("sender", cancel_sender);
|
|
39
39
|
worker.register_wf("receiver", cancel_receiver);
|
|
@@ -21,7 +21,7 @@ async fn cancelled_wf(ctx: WfContext) -> WorkflowResult<()> {
|
|
|
21
21
|
async fn cancel_during_timer() {
|
|
22
22
|
let wf_name = "cancel_during_timer";
|
|
23
23
|
let mut starter = CoreWfStarter::new(wf_name);
|
|
24
|
-
starter.no_remote_activities();
|
|
24
|
+
starter.worker_config.no_remote_activities(true);
|
|
25
25
|
let mut worker = starter.worker().await;
|
|
26
26
|
let client = starter.get_client().await;
|
|
27
27
|
worker.register_wf(wf_name.to_string(), cancelled_wf);
|
|
@@ -37,7 +37,7 @@ async fn parent_wf(ctx: WfContext) -> WorkflowResult<()> {
|
|
|
37
37
|
#[tokio::test]
|
|
38
38
|
async fn child_workflow_happy_path() {
|
|
39
39
|
let mut starter = CoreWfStarter::new("child-workflows");
|
|
40
|
-
starter.no_remote_activities();
|
|
40
|
+
starter.worker_config.no_remote_activities(true);
|
|
41
41
|
let mut worker = starter.worker().await;
|
|
42
42
|
|
|
43
43
|
worker.register_wf(PARENT_WF_TYPE.to_string(), parent_wf);
|
|
@@ -58,7 +58,7 @@ async fn child_workflow_happy_path() {
|
|
|
58
58
|
#[tokio::test]
|
|
59
59
|
async fn abandoned_child_bug_repro() {
|
|
60
60
|
let mut starter = CoreWfStarter::new("child-workflow-abandon-bug");
|
|
61
|
-
starter.no_remote_activities();
|
|
61
|
+
starter.worker_config.no_remote_activities(true);
|
|
62
62
|
let mut worker = starter.worker().await;
|
|
63
63
|
let barr: &'static Barrier = Box::leak(Box::new(Barrier::new(2)));
|
|
64
64
|
|
|
@@ -129,7 +129,7 @@ async fn abandoned_child_bug_repro() {
|
|
|
129
129
|
#[tokio::test]
|
|
130
130
|
async fn abandoned_child_resolves_post_cancel() {
|
|
131
131
|
let mut starter = CoreWfStarter::new("child-workflow-resolves-post-cancel");
|
|
132
|
-
starter.no_remote_activities();
|
|
132
|
+
starter.worker_config.no_remote_activities(true);
|
|
133
133
|
let mut worker = starter.worker().await;
|
|
134
134
|
let barr: &'static Barrier = Box::leak(Box::new(Barrier::new(2)));
|
|
135
135
|
|
|
@@ -21,7 +21,7 @@ async fn continue_as_new_wf(ctx: WfContext) -> WorkflowResult<()> {
|
|
|
21
21
|
async fn continue_as_new_happy_path() {
|
|
22
22
|
let wf_name = "continue_as_new_happy_path";
|
|
23
23
|
let mut starter = CoreWfStarter::new(wf_name);
|
|
24
|
-
starter.no_remote_activities();
|
|
24
|
+
starter.worker_config.no_remote_activities(true);
|
|
25
25
|
let mut worker = starter.worker().await;
|
|
26
26
|
worker.register_wf(wf_name.to_string(), continue_as_new_wf);
|
|
27
27
|
|
|
@@ -42,9 +42,10 @@ async fn continue_as_new_multiple_concurrent() {
|
|
|
42
42
|
let wf_name = "continue_as_new_multiple_concurrent";
|
|
43
43
|
let mut starter = CoreWfStarter::new(wf_name);
|
|
44
44
|
starter
|
|
45
|
-
.
|
|
46
|
-
.
|
|
47
|
-
.
|
|
45
|
+
.worker_config
|
|
46
|
+
.no_remote_activities(true)
|
|
47
|
+
.max_cached_workflows(5_usize)
|
|
48
|
+
.max_outstanding_workflow_tasks(5_usize);
|
|
48
49
|
let mut worker = starter.worker().await;
|
|
49
50
|
worker.register_wf(wf_name.to_string(), continue_as_new_wf);
|
|
50
51
|
|
|
@@ -6,7 +6,8 @@ use temporal_sdk::{ActivityOptions, WfContext, WorkflowResult};
|
|
|
6
6
|
use temporal_sdk_core_test_utils::CoreWfStarter;
|
|
7
7
|
|
|
8
8
|
static RUN_CT: AtomicUsize = AtomicUsize::new(1);
|
|
9
|
-
|
|
9
|
+
|
|
10
|
+
pub(crate) async fn timer_wf_nondeterministic(ctx: WfContext) -> WorkflowResult<()> {
|
|
10
11
|
let run_ct = RUN_CT.fetch_add(1, Ordering::Relaxed);
|
|
11
12
|
|
|
12
13
|
match run_ct {
|
|
@@ -35,7 +36,7 @@ pub async fn timer_wf_nondeterministic(ctx: WfContext) -> WorkflowResult<()> {
|
|
|
35
36
|
async fn test_determinism_error_then_recovers() {
|
|
36
37
|
let wf_name = "test_determinism_error_then_recovers";
|
|
37
38
|
let mut starter = CoreWfStarter::new(wf_name);
|
|
38
|
-
starter.no_remote_activities();
|
|
39
|
+
starter.worker_config.no_remote_activities(true);
|
|
39
40
|
let mut worker = starter.worker().await;
|
|
40
41
|
|
|
41
42
|
worker.register_wf(wf_name.to_owned(), timer_wf_nondeterministic);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
use std::time::Duration;
|
|
2
|
-
use temporal_client::
|
|
2
|
+
use temporal_client::WorkflowClientTrait;
|
|
3
3
|
use temporal_sdk::{WfContext, WorkflowResult};
|
|
4
4
|
use temporal_sdk_core_test_utils::{get_integ_server_options, CoreWfStarter, NAMESPACE};
|
|
5
5
|
|
|
6
|
-
pub async fn eager_wf(_context: WfContext) -> WorkflowResult<()> {
|
|
6
|
+
pub(crate) async fn eager_wf(_context: WfContext) -> WorkflowResult<()> {
|
|
7
7
|
Ok(().into())
|
|
8
8
|
}
|
|
9
9
|
|
|
@@ -14,7 +14,7 @@ async fn eager_wf_start() {
|
|
|
14
14
|
starter.workflow_options.enable_eager_workflow_start = true;
|
|
15
15
|
// hang the test if eager task dispatch failed
|
|
16
16
|
starter.workflow_options.task_timeout = Some(Duration::from_secs(1500));
|
|
17
|
-
starter.no_remote_activities();
|
|
17
|
+
starter.worker_config.no_remote_activities(true);
|
|
18
18
|
let mut worker = starter.worker().await;
|
|
19
19
|
worker.register_wf(wf_name.to_owned(), eager_wf);
|
|
20
20
|
starter.eager_start_with_worker(wf_name, &mut worker).await;
|
|
@@ -28,12 +28,12 @@ async fn eager_wf_start_different_clients() {
|
|
|
28
28
|
starter.workflow_options.enable_eager_workflow_start = true;
|
|
29
29
|
// hang the test if wf task needs retry
|
|
30
30
|
starter.workflow_options.task_timeout = Some(Duration::from_secs(1500));
|
|
31
|
-
starter.no_remote_activities();
|
|
31
|
+
starter.worker_config.no_remote_activities(true);
|
|
32
32
|
let mut worker = starter.worker().await;
|
|
33
33
|
worker.register_wf(wf_name.to_owned(), eager_wf);
|
|
34
34
|
|
|
35
35
|
let client = get_integ_server_options()
|
|
36
|
-
.connect(NAMESPACE.to_string(), None
|
|
36
|
+
.connect(NAMESPACE.to_string(), None)
|
|
37
37
|
.await
|
|
38
38
|
.expect("Should connect");
|
|
39
39
|
let w = starter.get_worker().await;
|
|
@@ -52,10 +52,6 @@ async fn eager_wf_start_different_clients() {
|
|
|
52
52
|
assert!(res.eager_workflow_task.is_none());
|
|
53
53
|
|
|
54
54
|
//wf task delivered through default path
|
|
55
|
-
worker.
|
|
56
|
-
namespace: NAMESPACE.to_string(),
|
|
57
|
-
workflow_id: wf_name.to_string(),
|
|
58
|
-
run_id: Some(res.run_id.clone()),
|
|
59
|
-
});
|
|
55
|
+
worker.expect_workflow_completion(wf_name, Some(res.run_id));
|
|
60
56
|
worker.run_until_done().await.unwrap();
|
|
61
57
|
}
|
|
@@ -26,7 +26,7 @@ use temporal_sdk_core_test_utils::{
|
|
|
26
26
|
};
|
|
27
27
|
use tokio_util::sync::CancellationToken;
|
|
28
28
|
|
|
29
|
-
pub async fn one_local_activity_wf(ctx: WfContext) -> WorkflowResult<()> {
|
|
29
|
+
pub(crate) async fn one_local_activity_wf(ctx: WfContext) -> WorkflowResult<()> {
|
|
30
30
|
let initial_workflow_time = ctx.workflow_time().expect("Workflow time should be set");
|
|
31
31
|
ctx.local_activity(LocalActivityOptions {
|
|
32
32
|
activity_type: "echo_activity".to_string(),
|
|
@@ -51,7 +51,7 @@ async fn one_local_activity() {
|
|
|
51
51
|
worker.run_until_done().await.unwrap();
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
pub async fn local_act_concurrent_with_timer_wf(ctx: WfContext) -> WorkflowResult<()> {
|
|
54
|
+
pub(crate) async fn local_act_concurrent_with_timer_wf(ctx: WfContext) -> WorkflowResult<()> {
|
|
55
55
|
let la = ctx.local_activity(LocalActivityOptions {
|
|
56
56
|
activity_type: "echo_activity".to_string(),
|
|
57
57
|
input: "hi!".as_json_payload().expect("serializes fine"),
|
|
@@ -74,7 +74,7 @@ async fn local_act_concurrent_with_timer() {
|
|
|
74
74
|
worker.run_until_done().await.unwrap();
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
pub async fn local_act_then_timer_then_wait(ctx: WfContext) -> WorkflowResult<()> {
|
|
77
|
+
pub(crate) async fn local_act_then_timer_then_wait(ctx: WfContext) -> WorkflowResult<()> {
|
|
78
78
|
let la = ctx.local_activity(LocalActivityOptions {
|
|
79
79
|
activity_type: "echo_activity".to_string(),
|
|
80
80
|
input: "hi!".as_json_payload().expect("serializes fine"),
|
|
@@ -114,7 +114,7 @@ async fn long_running_local_act_with_timer() {
|
|
|
114
114
|
worker.run_until_done().await.unwrap();
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
pub async fn local_act_fanout_wf(ctx: WfContext) -> WorkflowResult<()> {
|
|
117
|
+
pub(crate) async fn local_act_fanout_wf(ctx: WfContext) -> WorkflowResult<()> {
|
|
118
118
|
let las: Vec<_> = (1..=50)
|
|
119
119
|
.map(|i| {
|
|
120
120
|
ctx.local_activity(LocalActivityOptions {
|
|
@@ -135,7 +135,9 @@ pub async fn local_act_fanout_wf(ctx: WfContext) -> WorkflowResult<()> {
|
|
|
135
135
|
async fn local_act_fanout() {
|
|
136
136
|
let wf_name = "local_act_fanout";
|
|
137
137
|
let mut starter = CoreWfStarter::new(wf_name);
|
|
138
|
-
starter
|
|
138
|
+
starter
|
|
139
|
+
.worker_config
|
|
140
|
+
.max_outstanding_local_activities(1_usize);
|
|
139
141
|
let mut worker = starter.worker().await;
|
|
140
142
|
worker.register_wf(wf_name.to_owned(), local_act_fanout_wf);
|
|
141
143
|
worker.register_activity("echo_activity", echo);
|
|
@@ -424,7 +426,7 @@ async fn schedule_to_close_timeout_across_timer_backoff(#[case] cached: bool) {
|
|
|
424
426
|
);
|
|
425
427
|
let mut starter = CoreWfStarter::new(&wf_name);
|
|
426
428
|
if !cached {
|
|
427
|
-
starter.max_cached_workflows(
|
|
429
|
+
starter.worker_config.max_cached_workflows(0_usize);
|
|
428
430
|
}
|
|
429
431
|
let mut worker = starter.worker().await;
|
|
430
432
|
worker.register_wf(wf_name.to_owned(), |ctx: WfContext| async move {
|
|
@@ -465,7 +467,7 @@ async fn schedule_to_close_timeout_across_timer_backoff(#[case] cached: bool) {
|
|
|
465
467
|
async fn eviction_wont_make_local_act_get_dropped(#[values(true, false)] short_wft_timeout: bool) {
|
|
466
468
|
let wf_name = format!("eviction_wont_make_local_act_get_dropped_{short_wft_timeout}");
|
|
467
469
|
let mut starter = CoreWfStarter::new(&wf_name);
|
|
468
|
-
starter.max_cached_workflows(
|
|
470
|
+
starter.worker_config.max_cached_workflows(0_usize);
|
|
469
471
|
let mut worker = starter.worker().await;
|
|
470
472
|
worker.register_wf(wf_name.to_owned(), local_act_then_timer_then_wait);
|
|
471
473
|
worker.register_activity("echo_activity", |_ctx: ActContext, str: String| async {
|
|
@@ -20,7 +20,7 @@ async fn sends_modify_wf_props() {
|
|
|
20
20
|
let wf_name = "can_upsert_memo";
|
|
21
21
|
let wf_id = Uuid::new_v4();
|
|
22
22
|
let mut starter = CoreWfStarter::new(wf_name);
|
|
23
|
-
starter.no_remote_activities();
|
|
23
|
+
starter.worker_config.no_remote_activities(true);
|
|
24
24
|
let mut worker = starter.worker().await;
|
|
25
25
|
|
|
26
26
|
worker.register_wf(wf_name, memo_upserter);
|
|
@@ -14,7 +14,7 @@ use temporal_sdk_core_test_utils::CoreWfStarter;
|
|
|
14
14
|
|
|
15
15
|
const MY_PATCH_ID: &str = "integ_test_change_name";
|
|
16
16
|
|
|
17
|
-
pub async fn changes_wf(ctx: WfContext) -> WorkflowResult<()> {
|
|
17
|
+
pub(crate) async fn changes_wf(ctx: WfContext) -> WorkflowResult<()> {
|
|
18
18
|
if ctx.patched(MY_PATCH_ID) {
|
|
19
19
|
ctx.timer(Duration::from_millis(100)).await;
|
|
20
20
|
} else {
|
|
@@ -33,7 +33,7 @@ pub async fn changes_wf(ctx: WfContext) -> WorkflowResult<()> {
|
|
|
33
33
|
async fn writes_change_markers() {
|
|
34
34
|
let wf_name = "writes_change_markers";
|
|
35
35
|
let mut starter = CoreWfStarter::new(wf_name);
|
|
36
|
-
starter.no_remote_activities();
|
|
36
|
+
starter.worker_config.no_remote_activities(true);
|
|
37
37
|
let mut worker = starter.worker().await;
|
|
38
38
|
worker.register_wf(wf_name.to_owned(), changes_wf);
|
|
39
39
|
|
|
@@ -44,7 +44,8 @@ async fn writes_change_markers() {
|
|
|
44
44
|
/// This one simulates a run as if the worker had the "old" code, then it fails at the end as
|
|
45
45
|
/// a cheapo way of being re-run, at which point it runs with change checks and the "new" code.
|
|
46
46
|
static DID_DIE: AtomicBool = AtomicBool::new(false);
|
|
47
|
-
|
|
47
|
+
|
|
48
|
+
pub(crate) async fn no_change_then_change_wf(ctx: WfContext) -> WorkflowResult<()> {
|
|
48
49
|
if DID_DIE.load(Ordering::Acquire) {
|
|
49
50
|
assert!(!ctx.patched(MY_PATCH_ID));
|
|
50
51
|
}
|
|
@@ -66,7 +67,7 @@ pub async fn no_change_then_change_wf(ctx: WfContext) -> WorkflowResult<()> {
|
|
|
66
67
|
async fn can_add_change_markers() {
|
|
67
68
|
let wf_name = "can_add_change_markers";
|
|
68
69
|
let mut starter = CoreWfStarter::new(wf_name);
|
|
69
|
-
starter.no_remote_activities();
|
|
70
|
+
starter.worker_config.no_remote_activities(true);
|
|
70
71
|
let mut worker = starter.worker().await;
|
|
71
72
|
worker.register_wf(wf_name.to_owned(), no_change_then_change_wf);
|
|
72
73
|
|
|
@@ -75,7 +76,8 @@ async fn can_add_change_markers() {
|
|
|
75
76
|
}
|
|
76
77
|
|
|
77
78
|
static DID_DIE_2: AtomicBool = AtomicBool::new(false);
|
|
78
|
-
|
|
79
|
+
|
|
80
|
+
pub(crate) async fn replay_with_change_marker_wf(ctx: WfContext) -> WorkflowResult<()> {
|
|
79
81
|
assert!(ctx.patched(MY_PATCH_ID));
|
|
80
82
|
ctx.timer(Duration::from_millis(200)).await;
|
|
81
83
|
if !DID_DIE_2.load(Ordering::Acquire) {
|
|
@@ -89,7 +91,7 @@ pub async fn replay_with_change_marker_wf(ctx: WfContext) -> WorkflowResult<()>
|
|
|
89
91
|
async fn replaying_with_patch_marker() {
|
|
90
92
|
let wf_name = "replaying_with_patch_marker";
|
|
91
93
|
let mut starter = CoreWfStarter::new(wf_name);
|
|
92
|
-
starter.no_remote_activities();
|
|
94
|
+
starter.worker_config.no_remote_activities(true);
|
|
93
95
|
let mut worker = starter.worker().await;
|
|
94
96
|
worker.register_wf(wf_name.to_owned(), replay_with_change_marker_wf);
|
|
95
97
|
|
|
@@ -105,7 +107,10 @@ async fn patched_on_second_workflow_task_is_deterministic() {
|
|
|
105
107
|
let wf_name = "timer_patched_timer";
|
|
106
108
|
let mut starter = CoreWfStarter::new(wf_name);
|
|
107
109
|
// Disable caching to force replay from beginning
|
|
108
|
-
starter
|
|
110
|
+
starter
|
|
111
|
+
.worker_config
|
|
112
|
+
.max_cached_workflows(0_usize)
|
|
113
|
+
.no_remote_activities(true);
|
|
109
114
|
let mut worker = starter.worker().await;
|
|
110
115
|
// Include a task failure as well to make sure that works
|
|
111
116
|
static FAIL_ONCE: AtomicBool = AtomicBool::new(true);
|
|
@@ -128,7 +133,7 @@ async fn patched_on_second_workflow_task_is_deterministic() {
|
|
|
128
133
|
async fn can_remove_deprecated_patch_near_other_patch() {
|
|
129
134
|
let wf_name = "can_add_change_markers";
|
|
130
135
|
let mut starter = CoreWfStarter::new(wf_name);
|
|
131
|
-
starter.no_remote_activities();
|
|
136
|
+
starter.worker_config.no_remote_activities(true);
|
|
132
137
|
let mut worker = starter.worker().await;
|
|
133
138
|
let did_die = Arc::new(AtomicBool::new(false));
|
|
134
139
|
worker.register_wf(wf_name.to_owned(), move |ctx: WfContext| {
|
|
@@ -159,7 +164,7 @@ async fn can_remove_deprecated_patch_near_other_patch() {
|
|
|
159
164
|
async fn deprecated_patch_removal() {
|
|
160
165
|
let wf_name = "deprecated_patch_removal";
|
|
161
166
|
let mut starter = CoreWfStarter::new(wf_name);
|
|
162
|
-
starter.no_remote_activities();
|
|
167
|
+
starter.worker_config.no_remote_activities(true);
|
|
163
168
|
let mut worker = starter.worker().await;
|
|
164
169
|
let client = starter.get_client().await;
|
|
165
170
|
let wf_id = starter.get_task_queue().to_string();
|
|
@@ -14,7 +14,7 @@ const POST_RESET_SIG: &str = "post-reset";
|
|
|
14
14
|
async fn reset_workflow() {
|
|
15
15
|
let wf_name = "reset_me_wf";
|
|
16
16
|
let mut starter = CoreWfStarter::new(wf_name);
|
|
17
|
-
starter.no_remote_activities();
|
|
17
|
+
starter.worker_config.no_remote_activities(true);
|
|
18
18
|
let mut worker = starter.worker().await;
|
|
19
19
|
worker.fetch_results = false;
|
|
20
20
|
let notify = Arc::new(Notify::new());
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
use std::collections::HashMap;
|
|
2
2
|
|
|
3
3
|
use futures::StreamExt;
|
|
4
|
-
use temporal_client::{
|
|
5
|
-
SignalWithStartOptions, WorkflowClientTrait, WorkflowExecutionInfo, WorkflowOptions,
|
|
6
|
-
};
|
|
4
|
+
use temporal_client::{SignalWithStartOptions, WorkflowClientTrait, WorkflowOptions};
|
|
7
5
|
use temporal_sdk::{
|
|
8
6
|
ChildWorkflowOptions, Signal, SignalWorkflowOptions, WfContext, WorkflowResult,
|
|
9
7
|
};
|
|
@@ -34,7 +32,7 @@ async fn signal_sender(ctx: WfContext) -> WorkflowResult<()> {
|
|
|
34
32
|
async fn sends_signal_to_missing_wf() {
|
|
35
33
|
let wf_name = "sends_signal_to_missing_wf";
|
|
36
34
|
let mut starter = CoreWfStarter::new(wf_name);
|
|
37
|
-
starter.no_remote_activities();
|
|
35
|
+
starter.worker_config.no_remote_activities(true);
|
|
38
36
|
let mut worker = starter.worker().await;
|
|
39
37
|
worker.register_wf(wf_name.to_owned(), signal_sender);
|
|
40
38
|
|
|
@@ -73,7 +71,7 @@ async fn signal_with_create_wf_receiver(ctx: WfContext) -> WorkflowResult<()> {
|
|
|
73
71
|
#[tokio::test]
|
|
74
72
|
async fn sends_signal_to_other_wf() {
|
|
75
73
|
let mut starter = CoreWfStarter::new("sends_signal_to_other_wf");
|
|
76
|
-
starter.no_remote_activities();
|
|
74
|
+
starter.worker_config.no_remote_activities(true);
|
|
77
75
|
let mut worker = starter.worker().await;
|
|
78
76
|
worker.register_wf("sender", signal_sender);
|
|
79
77
|
worker.register_wf("receiver", signal_receiver);
|
|
@@ -102,7 +100,7 @@ async fn sends_signal_to_other_wf() {
|
|
|
102
100
|
#[tokio::test]
|
|
103
101
|
async fn sends_signal_with_create_wf() {
|
|
104
102
|
let mut starter = CoreWfStarter::new("sends_signal_with_create_wf");
|
|
105
|
-
starter.no_remote_activities();
|
|
103
|
+
starter.worker_config.no_remote_activities(true);
|
|
106
104
|
let mut worker = starter.worker().await;
|
|
107
105
|
worker.register_wf("receiver_signal", signal_with_create_wf_receiver);
|
|
108
106
|
|
|
@@ -123,12 +121,7 @@ async fn sends_signal_with_create_wf() {
|
|
|
123
121
|
.await
|
|
124
122
|
.expect("request succeeds.qed");
|
|
125
123
|
|
|
126
|
-
worker.
|
|
127
|
-
namespace: client.namespace().to_string(),
|
|
128
|
-
workflow_id: "sends_signal_with_create_wf".to_owned(),
|
|
129
|
-
run_id: Some(res.run_id.clone()),
|
|
130
|
-
});
|
|
131
|
-
|
|
124
|
+
worker.expect_workflow_completion("sends_signal_with_create_wf", Some(res.run_id));
|
|
132
125
|
worker.run_until_done().await.unwrap();
|
|
133
126
|
}
|
|
134
127
|
|
|
@@ -153,7 +146,7 @@ async fn signals_child(ctx: WfContext) -> WorkflowResult<()> {
|
|
|
153
146
|
#[tokio::test]
|
|
154
147
|
async fn sends_signal_to_child() {
|
|
155
148
|
let mut starter = CoreWfStarter::new("sends_signal_to_child");
|
|
156
|
-
starter.no_remote_activities();
|
|
149
|
+
starter.worker_config.no_remote_activities(true);
|
|
157
150
|
let mut worker = starter.worker().await;
|
|
158
151
|
worker.register_wf("child_signaler", signals_child);
|
|
159
152
|
worker.register_wf("child_receiver", signal_receiver);
|
|
@@ -12,8 +12,10 @@ use tokio::sync::Barrier;
|
|
|
12
12
|
async fn timer_workflow_not_sticky() {
|
|
13
13
|
let wf_name = "timer_wf_not_sticky";
|
|
14
14
|
let mut starter = CoreWfStarter::new(wf_name);
|
|
15
|
-
starter
|
|
16
|
-
|
|
15
|
+
starter
|
|
16
|
+
.worker_config
|
|
17
|
+
.no_remote_activities(true)
|
|
18
|
+
.max_cached_workflows(0_usize);
|
|
17
19
|
let mut worker = starter.worker().await;
|
|
18
20
|
worker.register_wf(wf_name.to_owned(), timer_wf);
|
|
19
21
|
|
|
@@ -40,7 +42,7 @@ async fn timer_workflow_timeout_on_sticky() {
|
|
|
40
42
|
// on a not-sticky queue
|
|
41
43
|
let wf_name = "timer_workflow_timeout_on_sticky";
|
|
42
44
|
let mut starter = CoreWfStarter::new(wf_name);
|
|
43
|
-
starter.no_remote_activities();
|
|
45
|
+
starter.worker_config.no_remote_activities(true);
|
|
44
46
|
starter.workflow_options.task_timeout = Some(Duration::from_secs(2));
|
|
45
47
|
let mut worker = starter.worker().await;
|
|
46
48
|
worker.register_wf(wf_name.to_owned(), timer_timeout_wf);
|
|
@@ -56,9 +58,10 @@ async fn cache_miss_ok() {
|
|
|
56
58
|
let wf_name = "cache_miss_ok";
|
|
57
59
|
let mut starter = CoreWfStarter::new(wf_name);
|
|
58
60
|
starter
|
|
59
|
-
.
|
|
60
|
-
.
|
|
61
|
-
.
|
|
61
|
+
.worker_config
|
|
62
|
+
.no_remote_activities(true)
|
|
63
|
+
.max_outstanding_workflow_tasks(2_usize)
|
|
64
|
+
.max_cached_workflows(0_usize);
|
|
62
65
|
starter.worker_config.max_concurrent_wft_polls(1_usize);
|
|
63
66
|
let mut worker = starter.worker().await;
|
|
64
67
|
|
|
@@ -10,7 +10,7 @@ use temporal_sdk_core_test_utils::{
|
|
|
10
10
|
WorkerTestHelpers,
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
pub async fn timer_wf(command_sink: WfContext) -> WorkflowResult<()> {
|
|
13
|
+
pub(crate) async fn timer_wf(command_sink: WfContext) -> WorkflowResult<()> {
|
|
14
14
|
command_sink.timer(Duration::from_secs(1)).await;
|
|
15
15
|
Ok(().into())
|
|
16
16
|
}
|
|
@@ -19,7 +19,7 @@ pub async fn timer_wf(command_sink: WfContext) -> WorkflowResult<()> {
|
|
|
19
19
|
async fn timer_workflow_workflow_driver() {
|
|
20
20
|
let wf_name = "timer_wf_new";
|
|
21
21
|
let mut starter = CoreWfStarter::new(wf_name);
|
|
22
|
-
starter.no_remote_activities();
|
|
22
|
+
starter.worker_config.no_remote_activities(true);
|
|
23
23
|
let mut worker = starter.worker().await;
|
|
24
24
|
worker.register_wf(wf_name.to_owned(), timer_wf);
|
|
25
25
|
|
|
@@ -31,7 +31,7 @@ async fn timer_workflow_workflow_driver() {
|
|
|
31
31
|
async fn timer_workflow_manual() {
|
|
32
32
|
let mut starter = init_core_and_create_wf("timer_workflow").await;
|
|
33
33
|
let core = starter.get_worker().await;
|
|
34
|
-
starter.no_remote_activities();
|
|
34
|
+
starter.worker_config.no_remote_activities(true);
|
|
35
35
|
let task = core.poll_workflow_activation().await.unwrap();
|
|
36
36
|
core.complete_workflow_activation(WorkflowActivationCompletion::from_cmds(
|
|
37
37
|
task.run_id,
|
|
@@ -52,7 +52,7 @@ async fn timer_workflow_manual() {
|
|
|
52
52
|
async fn timer_cancel_workflow() {
|
|
53
53
|
let mut starter = init_core_and_create_wf("timer_cancel_workflow").await;
|
|
54
54
|
let core = starter.get_worker().await;
|
|
55
|
-
starter.no_remote_activities();
|
|
55
|
+
starter.worker_config.no_remote_activities(true);
|
|
56
56
|
let task = core.poll_workflow_activation().await.unwrap();
|
|
57
57
|
core.complete_workflow_activation(WorkflowActivationCompletion::from_cmds(
|
|
58
58
|
task.run_id,
|
|
@@ -111,7 +111,7 @@ async fn parallel_timer_wf(command_sink: WfContext) -> WorkflowResult<()> {
|
|
|
111
111
|
async fn parallel_timers() {
|
|
112
112
|
let wf_name = "parallel_timers";
|
|
113
113
|
let mut starter = CoreWfStarter::new(wf_name);
|
|
114
|
-
starter.no_remote_activities();
|
|
114
|
+
starter.worker_config.no_remote_activities(true);
|
|
115
115
|
let mut worker = starter.worker().await;
|
|
116
116
|
worker.register_wf(wf_name.to_owned(), parallel_timer_wf);
|
|
117
117
|
|