@temporalio/core-bridge 1.13.1 → 1.14.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 +350 -436
- package/Cargo.toml +14 -13
- package/{sdk-core/fsm/rustfsm_procmacro/LICENSE.txt → LICENSE} +5 -5
- package/README.md +0 -1
- package/bridge-macros/Cargo.toml +16 -0
- package/bridge-macros/src/derive_js_function.rs +126 -0
- package/bridge-macros/src/derive_tryfromjs.rs +138 -0
- package/bridge-macros/src/derive_tryintojs.rs +151 -0
- package/bridge-macros/src/lib.rs +42 -0
- package/lib/native.d.ts +23 -9
- package/package.json +6 -5
- 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/sdk-core/.cargo/config.toml +78 -12
- package/sdk-core/.clippy.toml +1 -0
- package/sdk-core/.github/workflows/heavy.yml +2 -0
- package/sdk-core/.github/workflows/per-pr.yml +90 -21
- package/sdk-core/AGENTS.md +17 -19
- package/sdk-core/ARCHITECTURE.md +44 -48
- package/sdk-core/Cargo.toml +25 -7
- package/sdk-core/README.md +16 -15
- package/sdk-core/arch_docs/diagrams/TimerMachine_Coverage.puml +14 -0
- package/sdk-core/arch_docs/diagrams/deps.svg +102 -0
- package/sdk-core/arch_docs/diagrams/initial_event_history.png +0 -0
- package/sdk-core/arch_docs/sdks_intro.md +299 -0
- package/sdk-core/{client → crates/client}/Cargo.toml +15 -16
- package/sdk-core/{client → crates/client}/src/callback_based.rs +1 -2
- package/sdk-core/{client → crates/client}/src/lib.rs +594 -457
- package/sdk-core/{client → crates/client}/src/metrics.rs +32 -8
- package/sdk-core/crates/client/src/proxy.rs +209 -0
- package/sdk-core/{client → crates/client}/src/raw.rs +648 -328
- package/sdk-core/crates/client/src/replaceable.rs +253 -0
- package/sdk-core/crates/client/src/request_extensions.rs +40 -0
- package/sdk-core/{client → crates/client}/src/retry.rs +32 -22
- package/sdk-core/crates/client/src/worker/mod.rs +1468 -0
- package/sdk-core/{client → crates/client}/src/workflow_handle/mod.rs +24 -21
- package/sdk-core/{core-api → crates/common}/Cargo.toml +21 -12
- package/sdk-core/{sdk-core-protos → crates/common}/build.rs +10 -23
- package/sdk-core/crates/common/protos/api_cloud_upstream/VERSION +1 -0
- package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/account/v1/message.proto +18 -0
- package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/cloudservice/v1/request_response.proto +38 -11
- package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/cloudservice/v1/service.proto +21 -4
- package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/operation/v1/message.proto +6 -6
- package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/sink/v1/message.proto +22 -0
- package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/workflows/create-release.yml +13 -0
- package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/openapi/openapiv2.json +254 -5
- package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/openapi/openapiv3.yaml +234 -5
- package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/common/v1/message.proto +1 -1
- package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/deployment/v1/message.proto +6 -0
- package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/namespace/v1/message.proto +6 -2
- package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto +60 -2
- package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/workflowservice/v1/service.proto +30 -6
- package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/workflow_activation/workflow_activation.proto +2 -0
- package/sdk-core/{core-api → crates/common}/src/envconfig.rs +155 -56
- package/sdk-core/{core-api → crates/common}/src/errors.rs +8 -1
- package/sdk-core/{fsm/rustfsm_trait/src/lib.rs → crates/common/src/fsm_trait.rs} +1 -27
- package/sdk-core/{core-api → crates/common}/src/lib.rs +92 -9
- package/sdk-core/{test-utils/src → crates/common/src/protos}/canned_histories.rs +5 -5
- package/sdk-core/{sdk-core-protos/src → crates/common/src/protos}/history_builder.rs +3 -3
- package/sdk-core/{sdk-core-protos/src → crates/common/src/protos}/history_info.rs +2 -2
- package/sdk-core/{sdk-core-protos/src/lib.rs → crates/common/src/protos/mod.rs} +43 -26
- package/sdk-core/crates/common/src/protos/test_utils.rs +89 -0
- package/sdk-core/{sdk-core-protos/src → crates/common/src/protos}/utilities.rs +14 -5
- package/sdk-core/{core-api → crates/common}/src/telemetry/metrics.rs +449 -51
- package/sdk-core/{core-api → crates/common}/src/telemetry.rs +16 -1
- package/sdk-core/{core-api → crates/common}/src/worker.rs +112 -18
- package/sdk-core/crates/common/tests/worker_task_types_test.rs +129 -0
- package/sdk-core/crates/macros/Cargo.toml +23 -0
- package/sdk-core/{fsm/rustfsm_procmacro → crates/macros}/src/lib.rs +12 -12
- package/sdk-core/{sdk → crates/sdk}/Cargo.toml +18 -12
- package/sdk-core/{sdk → crates/sdk}/src/activity_context.rs +9 -7
- package/sdk-core/{sdk → crates/sdk}/src/app_data.rs +1 -1
- package/sdk-core/{sdk → crates/sdk}/src/interceptors.rs +2 -5
- package/sdk-core/{sdk → crates/sdk}/src/lib.rs +43 -42
- package/sdk-core/{sdk → crates/sdk}/src/workflow_context/options.rs +12 -3
- package/sdk-core/{sdk → crates/sdk}/src/workflow_context.rs +21 -19
- package/sdk-core/{sdk → crates/sdk}/src/workflow_future.rs +2 -2
- package/sdk-core/crates/sdk-core/Cargo.toml +222 -0
- package/sdk-core/{core/benches/workflow_replay.rs → crates/sdk-core/benches/workflow_replay_bench.rs} +15 -10
- package/sdk-core/crates/sdk-core/machine_coverage/ActivityMachine_Coverage.puml +32 -0
- package/sdk-core/crates/sdk-core/machine_coverage/CancelExternalMachine_Coverage.puml +9 -0
- package/sdk-core/crates/sdk-core/machine_coverage/CancelWorkflowMachine_Coverage.puml +6 -0
- package/sdk-core/crates/sdk-core/machine_coverage/ChildWorkflowMachine_Coverage.puml +27 -0
- package/sdk-core/crates/sdk-core/machine_coverage/CompleteWorkflowMachine_Coverage.puml +6 -0
- package/sdk-core/crates/sdk-core/machine_coverage/ContinueAsNewWorkflowMachine_Coverage.puml +6 -0
- package/sdk-core/crates/sdk-core/machine_coverage/FailWorkflowMachine_Coverage.puml +6 -0
- package/sdk-core/crates/sdk-core/machine_coverage/LocalActivityMachine_Coverage.puml +23 -0
- package/sdk-core/crates/sdk-core/machine_coverage/ModifyWorkflowPropertiesMachine_Coverage.puml +5 -0
- package/sdk-core/crates/sdk-core/machine_coverage/PatchMachine_Coverage.puml +8 -0
- package/sdk-core/crates/sdk-core/machine_coverage/SignalExternalMachine_Coverage.puml +12 -0
- package/sdk-core/crates/sdk-core/machine_coverage/TimerMachine_Coverage.puml +13 -0
- package/sdk-core/crates/sdk-core/machine_coverage/UpdateMachine_Coverage.puml +19 -0
- package/sdk-core/crates/sdk-core/machine_coverage/UpsertSearchAttributesMachine_Coverage.puml +5 -0
- package/sdk-core/crates/sdk-core/machine_coverage/WorkflowTaskMachine_Coverage.puml +11 -0
- package/sdk-core/{core → crates/sdk-core}/src/abstractions.rs +62 -6
- package/sdk-core/crates/sdk-core/src/antithesis.rs +60 -0
- package/sdk-core/{core → crates/sdk-core}/src/core_tests/activity_tasks.rs +85 -250
- package/sdk-core/{core → crates/sdk-core}/src/core_tests/mod.rs +13 -16
- package/sdk-core/{core → crates/sdk-core}/src/core_tests/queries.rs +25 -24
- package/sdk-core/{core → crates/sdk-core}/src/core_tests/replay_flag.rs +11 -68
- package/sdk-core/{core → crates/sdk-core}/src/core_tests/updates.rs +21 -20
- package/sdk-core/{core → crates/sdk-core}/src/core_tests/workers.rs +242 -16
- package/sdk-core/{core → crates/sdk-core}/src/core_tests/workflow_cancels.rs +10 -7
- package/sdk-core/{core → crates/sdk-core}/src/core_tests/workflow_tasks.rs +150 -326
- package/sdk-core/{core → crates/sdk-core}/src/debug_client.rs +1 -1
- package/sdk-core/{core → crates/sdk-core}/src/ephemeral_server/mod.rs +18 -6
- package/sdk-core/{test-utils → crates/sdk-core}/src/histfetch.rs +9 -4
- package/sdk-core/{core → crates/sdk-core}/src/internal_flags.rs +15 -4
- package/sdk-core/{core → crates/sdk-core}/src/lib.rs +128 -72
- package/sdk-core/{core → crates/sdk-core}/src/pollers/mod.rs +13 -11
- package/sdk-core/{core → crates/sdk-core}/src/pollers/poll_buffer.rs +53 -18
- package/sdk-core/{core → crates/sdk-core}/src/protosext/mod.rs +14 -6
- package/sdk-core/{core → crates/sdk-core}/src/protosext/protocol_messages.rs +5 -12
- package/sdk-core/{core → crates/sdk-core}/src/replay/mod.rs +14 -11
- package/sdk-core/crates/sdk-core/src/retry_logic.rs +390 -0
- package/sdk-core/{core → crates/sdk-core}/src/telemetry/log_export.rs +2 -2
- package/sdk-core/{core → crates/sdk-core}/src/telemetry/metrics.rs +80 -33
- package/sdk-core/{core → crates/sdk-core}/src/telemetry/mod.rs +12 -6
- package/sdk-core/{core → crates/sdk-core}/src/telemetry/otel.rs +1 -1
- package/sdk-core/{core → crates/sdk-core}/src/telemetry/prometheus_meter.rs +14 -14
- package/sdk-core/{core → crates/sdk-core}/src/telemetry/prometheus_server.rs +2 -2
- package/sdk-core/{core/src/test_help/mod.rs → crates/sdk-core/src/test_help/integ_helpers.rs} +284 -329
- package/sdk-core/crates/sdk-core/src/test_help/mod.rs +13 -0
- package/sdk-core/crates/sdk-core/src/test_help/unit_helpers.rs +220 -0
- package/sdk-core/{core → crates/sdk-core}/src/worker/activities/activity_heartbeat_manager.rs +44 -8
- package/sdk-core/{core → crates/sdk-core}/src/worker/activities/local_activities.rs +33 -31
- package/sdk-core/{core → crates/sdk-core}/src/worker/activities.rs +31 -15
- package/sdk-core/{core → crates/sdk-core}/src/worker/client/mocks.rs +28 -15
- package/sdk-core/{core → crates/sdk-core}/src/worker/client.rs +275 -145
- package/sdk-core/crates/sdk-core/src/worker/heartbeat.rs +246 -0
- package/sdk-core/crates/sdk-core/src/worker/mod.rs +1462 -0
- package/sdk-core/{core → crates/sdk-core}/src/worker/nexus.rs +24 -12
- package/sdk-core/{core → crates/sdk-core}/src/worker/slot_provider.rs +18 -10
- package/sdk-core/{core → crates/sdk-core}/src/worker/tuner/fixed_size.rs +5 -1
- package/sdk-core/{core → crates/sdk-core}/src/worker/tuner/resource_based.rs +453 -57
- package/sdk-core/{core → crates/sdk-core}/src/worker/tuner.rs +179 -3
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/driven_workflow.rs +1 -1
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/history_update.rs +5 -267
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/activity_state_machine.rs +147 -90
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/cancel_external_state_machine.rs +8 -91
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/cancel_nexus_op_state_machine.rs +14 -12
- package/sdk-core/crates/sdk-core/src/worker/workflow/machines/cancel_workflow_state_machine.rs +97 -0
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/child_workflow_state_machine.rs +32 -229
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/complete_workflow_state_machine.rs +13 -8
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/continue_as_new_workflow_state_machine.rs +6 -50
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/fail_workflow_state_machine.rs +6 -7
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/local_activity_state_machine.rs +39 -584
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/mod.rs +22 -17
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/modify_workflow_properties_state_machine.rs +4 -74
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/nexus_operation_state_machine.rs +118 -21
- package/sdk-core/crates/sdk-core/src/worker/workflow/machines/patch_state_machine.rs +273 -0
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/signal_external_state_machine.rs +9 -151
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/timer_state_machine.rs +27 -132
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/transition_coverage.rs +1 -2
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/update_state_machine.rs +19 -13
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/upsert_search_attributes_state_machine.rs +25 -80
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/workflow_machines/local_acts.rs +1 -1
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/workflow_machines.rs +68 -72
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/workflow_task_state_machine.rs +13 -15
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/managed_run.rs +55 -37
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/mod.rs +171 -61
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/run_cache.rs +10 -7
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/wft_extraction.rs +4 -2
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/wft_poller.rs +15 -4
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/workflow_stream.rs +38 -19
- package/sdk-core/crates/sdk-core/tests/c_bridge_smoke_test.c +10 -0
- package/sdk-core/crates/sdk-core/tests/cloud_tests.rs +25 -0
- package/sdk-core/crates/sdk-core/tests/common/fake_grpc_server.rs +106 -0
- package/sdk-core/crates/sdk-core/tests/common/http_proxy.rs +134 -0
- package/sdk-core/{test-utils/src/lib.rs → crates/sdk-core/tests/common/mod.rs} +286 -334
- package/sdk-core/{test-utils/src → crates/sdk-core/tests/common}/workflows.rs +6 -4
- package/sdk-core/crates/sdk-core/tests/fsm_procmacro.rs +6 -0
- package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/dupe_transitions_fail.rs +1 -3
- package/sdk-core/crates/sdk-core/tests/fsm_trybuild/dupe_transitions_fail.stderr +12 -0
- package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/dynamic_dest_pass.rs +2 -4
- package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/forgot_name_fail.rs +1 -3
- package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/forgot_name_fail.stderr +4 -4
- package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/handler_arg_pass.rs +2 -4
- package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/handler_pass.rs +2 -4
- package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/medium_complex_pass.rs +2 -4
- package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/no_handle_conversions_require_into_fail.rs +2 -4
- package/sdk-core/crates/sdk-core/tests/fsm_trybuild/no_handle_conversions_require_into_fail.stderr +15 -0
- package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/simple_pass.rs +2 -4
- package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/struct_event_variant_fail.rs +1 -3
- package/sdk-core/crates/sdk-core/tests/fsm_trybuild/struct_event_variant_fail.stderr +5 -0
- package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/tuple_more_item_event_variant_fail.rs +1 -3
- package/sdk-core/crates/sdk-core/tests/fsm_trybuild/tuple_more_item_event_variant_fail.stderr +5 -0
- package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/tuple_zero_item_event_variant_fail.rs +1 -3
- package/sdk-core/crates/sdk-core/tests/fsm_trybuild/tuple_zero_item_event_variant_fail.stderr +5 -0
- package/sdk-core/{tests → crates/sdk-core/tests}/global_metric_tests.rs +22 -22
- package/sdk-core/{tests → crates/sdk-core/tests/heavy_tests}/fuzzy_workflow.rs +4 -4
- package/sdk-core/{tests → crates/sdk-core/tests}/heavy_tests.rs +25 -14
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/activity_functions.rs +1 -1
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/client_tests.rs +115 -123
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/ephemeral_server_tests.rs +19 -15
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/heartbeat_tests.rs +24 -20
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/metrics_tests.rs +241 -67
- package/sdk-core/crates/sdk-core/tests/integ_tests/pagination_tests.rs +273 -0
- package/sdk-core/crates/sdk-core/tests/integ_tests/polling_tests.rs +513 -0
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/queries_tests.rs +13 -11
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/update_tests.rs +47 -29
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/visibility_tests.rs +49 -27
- package/sdk-core/crates/sdk-core/tests/integ_tests/worker_heartbeat_tests.rs +1061 -0
- package/sdk-core/crates/sdk-core/tests/integ_tests/worker_tests.rs +920 -0
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/worker_versioning_tests.rs +58 -40
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/activities.rs +268 -30
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/appdata_propagation.rs +4 -4
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/cancel_external.rs +155 -0
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/cancel_wf.rs +121 -0
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/child_workflows.rs +717 -0
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/continue_as_new.rs +109 -0
- package/sdk-core/{core/src/core_tests → crates/sdk-core/tests/integ_tests/workflow_tests}/determinism.rs +108 -20
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/eager.rs +10 -5
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/local_activities.rs +2884 -0
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/modify_wf_properties.rs +119 -0
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/nexus.rs +174 -46
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/patches.rs +740 -0
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/replay.rs +78 -27
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/resets.rs +46 -28
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/signals.rs +294 -0
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/stickyness.rs +9 -8
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/timers.rs +249 -0
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/upsert_search_attrs.rs +72 -7
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests.rs +97 -33
- package/sdk-core/{tests → crates/sdk-core/tests}/main.rs +40 -25
- package/sdk-core/{tests → crates/sdk-core/tests}/manual_tests.rs +25 -15
- package/sdk-core/{tests → crates/sdk-core/tests}/runner.rs +23 -41
- package/sdk-core/{tests → crates/sdk-core/tests}/shared_tests/mod.rs +11 -6
- package/sdk-core/{tests → crates/sdk-core/tests}/shared_tests/priority.rs +6 -6
- package/sdk-core/crates/sdk-core-c-bridge/Cargo.toml +59 -0
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/include/temporal-sdk-core-c-bridge.h +215 -44
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/client.rs +515 -214
- package/sdk-core/crates/sdk-core-c-bridge/src/envconfig.rs +314 -0
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/lib.rs +2 -1
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/metric.rs +1 -1
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/random.rs +4 -4
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/runtime.rs +42 -28
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/testing.rs +2 -5
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/tests/context.rs +42 -41
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/tests/mod.rs +38 -34
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/tests/utils.rs +10 -11
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/worker.rs +427 -121
- package/sdk-core/docker-cgroup-tests.sh +24 -0
- package/sdk-core/{docker → etc/docker}/docker-compose-ci.yaml +9 -9
- package/sdk-core/{docker → etc/docker}/docker-compose-telem.yaml +11 -11
- package/sdk-core/{docker → etc/docker}/docker-compose.yaml +8 -8
- package/sdk-core/{integ-with-otel.sh → etc/integ-with-otel.sh} +1 -1
- package/sdk-core/etc/regen-depgraph.sh +2 -2
- package/src/client.rs +117 -49
- package/src/helpers/callbacks.rs +4 -4
- package/src/helpers/errors.rs +7 -1
- package/src/helpers/handles.rs +1 -0
- package/src/helpers/try_from_js.rs +5 -4
- package/src/lib.rs +3 -2
- package/src/logs.rs +1 -1
- package/src/metrics.rs +6 -3
- package/src/runtime.rs +41 -24
- package/src/testing.rs +3 -3
- package/src/worker.rs +77 -44
- package/ts/native.ts +26 -9
- package/LICENSE.md +0 -23
- package/sdk-core/arch_docs/diagrams/workflow_internals.svg +0 -1
- package/sdk-core/client/src/proxy.rs +0 -90
- package/sdk-core/client/src/worker_registry/mod.rs +0 -266
- package/sdk-core/core/Cargo.toml +0 -146
- package/sdk-core/core/src/core_tests/child_workflows.rs +0 -281
- package/sdk-core/core/src/core_tests/local_activities.rs +0 -1442
- package/sdk-core/core/src/retry_logic.rs +0 -224
- package/sdk-core/core/src/worker/heartbeat.rs +0 -231
- package/sdk-core/core/src/worker/mod.rs +0 -980
- package/sdk-core/core/src/worker/workflow/machines/cancel_workflow_state_machine.rs +0 -165
- package/sdk-core/core/src/worker/workflow/machines/patch_state_machine.rs +0 -801
- package/sdk-core/core-c-bridge/Cargo.toml +0 -51
- package/sdk-core/etc/deps.svg +0 -162
- package/sdk-core/fsm/Cargo.toml +0 -21
- package/sdk-core/fsm/README.md +0 -3
- package/sdk-core/fsm/rustfsm_procmacro/Cargo.toml +0 -27
- package/sdk-core/fsm/rustfsm_procmacro/tests/progress.rs +0 -8
- package/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/dupe_transitions_fail.stderr +0 -12
- package/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/no_handle_conversions_require_into_fail.stderr +0 -15
- package/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/struct_event_variant_fail.stderr +0 -5
- package/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/tuple_more_item_event_variant_fail.stderr +0 -5
- package/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/tuple_zero_item_event_variant_fail.stderr +0 -5
- package/sdk-core/fsm/rustfsm_trait/Cargo.toml +0 -14
- package/sdk-core/fsm/rustfsm_trait/LICENSE.txt +0 -21
- package/sdk-core/fsm/src/lib.rs +0 -2
- package/sdk-core/sdk-core-protos/Cargo.toml +0 -37
- package/sdk-core/sdk-core-protos/protos/api_cloud_upstream/VERSION +0 -1
- package/sdk-core/test-utils/Cargo.toml +0 -38
- package/sdk-core/test-utils/src/interceptors.rs +0 -46
- package/sdk-core/tests/cloud_tests.rs +0 -23
- package/sdk-core/tests/integ_tests/polling_tests.rs +0 -294
- package/sdk-core/tests/integ_tests/worker_tests.rs +0 -203
- package/sdk-core/tests/integ_tests/workflow_tests/cancel_external.rs +0 -74
- package/sdk-core/tests/integ_tests/workflow_tests/cancel_wf.rs +0 -57
- package/sdk-core/tests/integ_tests/workflow_tests/child_workflows.rs +0 -246
- package/sdk-core/tests/integ_tests/workflow_tests/continue_as_new.rs +0 -65
- package/sdk-core/tests/integ_tests/workflow_tests/determinism.rs +0 -85
- package/sdk-core/tests/integ_tests/workflow_tests/local_activities.rs +0 -908
- package/sdk-core/tests/integ_tests/workflow_tests/modify_wf_properties.rs +0 -51
- package/sdk-core/tests/integ_tests/workflow_tests/patches.rs +0 -206
- package/sdk-core/tests/integ_tests/workflow_tests/signals.rs +0 -164
- package/sdk-core/tests/integ_tests/workflow_tests/timers.rs +0 -123
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/.github/workflows/build.yaml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/.github/workflows/push-to-buf.yml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/CODEOWNERS +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/LICENSE +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/Makefile +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/README.md +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/buf.gen.yaml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/buf.lock +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/buf.yaml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/connectivityrule/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/identity/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/namespace/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/nexus/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/region/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/resource/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/usage/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/CODEOWNERS +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/workflows/ci.yml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/workflows/publish-docs.yml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/workflows/push-to-buf.yml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/workflows/trigger-api-go-delete-release.yml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/workflows/trigger-api-go-publish-release.yml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/workflows/trigger-api-go-update.yml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/LICENSE +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/Makefile +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/README.md +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/api-linter.yaml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/buf.gen.yaml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/buf.lock +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/buf.yaml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/api/annotations.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/api/http.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/protobuf/any.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/protobuf/descriptor.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/protobuf/duration.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/protobuf/empty.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/protobuf/struct.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/protobuf/timestamp.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/protobuf/wrappers.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/openapi/payload_description.txt +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/activity/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/batch/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/command/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/batch_operation.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/command_type.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/common.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/deployment.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/event_type.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/failed_cause.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/namespace.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/nexus.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/query.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/reset.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/schedule.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/task_queue.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/update.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/workflow.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/errordetails/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/export/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/failure/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/filter/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/history/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/nexus/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/operatorservice/v1/request_response.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/operatorservice/v1/service.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/protocol/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/query/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/replication/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/rules/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/schedule/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/sdk/v1/enhanced_stack_trace.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/sdk/v1/task_complete_metadata.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/sdk/v1/user_metadata.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/sdk/v1/worker_config.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/sdk/v1/workflow_metadata.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/taskqueue/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/update/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/version/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/worker/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/workflow/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/google/rpc/status.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/grpc/health/v1/health.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/activity_result/activity_result.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/activity_task/activity_task.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/child_workflow/child_workflow.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/common/common.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/core_interface.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/external_data/external_data.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/nexus/nexus.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/workflow_commands/workflow_commands.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/workflow_completion/workflow_completion.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/testsrv_upstream/Makefile +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/testsrv_upstream/api-linter.yaml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/testsrv_upstream/buf.yaml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/testsrv_upstream/temporal/api/testservice/v1/request_response.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/testsrv_upstream/temporal/api/testservice/v1/service.proto +0 -0
- /package/sdk-core/{sdk-core-protos/src → crates/common/src/protos}/constants.rs +0 -0
- /package/sdk-core/{sdk-core-protos/src → crates/common/src/protos}/task_token.rs +0 -0
- /package/sdk-core/{fsm → crates/macros}/LICENSE.txt +0 -0
- /package/sdk-core/{core → crates/sdk-core}/src/abstractions/take_cell.rs +0 -0
- /package/sdk-core/{core → crates/sdk-core}/src/worker/slot_supplier.rs +0 -0
- /package/sdk-core/{histories → crates/sdk-core/tests/histories}/ends_empty_wft_complete.bin +0 -0
- /package/sdk-core/{histories → crates/sdk-core/tests/histories}/evict_while_la_running_no_interference-16_history.bin +0 -0
- /package/sdk-core/{histories → crates/sdk-core/tests/histories}/evict_while_la_running_no_interference-23_history.bin +0 -0
- /package/sdk-core/{histories → crates/sdk-core/tests/histories}/evict_while_la_running_no_interference-85_history.bin +0 -0
- /package/sdk-core/{histories → crates/sdk-core/tests/histories}/fail_wf_task.bin +0 -0
- /package/sdk-core/{histories → crates/sdk-core/tests/histories}/long_local_activity_with_update-0_history.bin +0 -0
- /package/sdk-core/{histories → crates/sdk-core/tests/histories}/long_local_activity_with_update-1_history.bin +0 -0
- /package/sdk-core/{histories → crates/sdk-core/tests/histories}/long_local_activity_with_update-2_history.bin +0 -0
- /package/sdk-core/{histories → crates/sdk-core/tests/histories}/long_local_activity_with_update-3_history.bin +0 -0
- /package/sdk-core/{histories → crates/sdk-core/tests/histories}/old_change_marker_format.bin +0 -0
- /package/sdk-core/{histories → crates/sdk-core/tests/histories}/timer_workflow_history.bin +0 -0
- /package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/priority.rs +0 -0
- /package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/build.rs +0 -0
- /package/sdk-core/{cargo-tokio-console.sh → etc/cargo-tokio-console.sh} +0 -0
|
@@ -0,0 +1,513 @@
|
|
|
1
|
+
use crate::{
|
|
2
|
+
common::{
|
|
3
|
+
CoreWfStarter, INTEG_CLIENT_NAME, INTEG_CLIENT_VERSION, get_integ_server_options,
|
|
4
|
+
init_core_and_create_wf, init_integ_telem, integ_dev_server_config, integ_worker_config,
|
|
5
|
+
},
|
|
6
|
+
integ_tests::activity_functions::echo,
|
|
7
|
+
};
|
|
8
|
+
use assert_matches::assert_matches;
|
|
9
|
+
use futures_util::{FutureExt, StreamExt, future::join_all};
|
|
10
|
+
use std::{
|
|
11
|
+
process::Stdio,
|
|
12
|
+
sync::{
|
|
13
|
+
Arc, Mutex,
|
|
14
|
+
atomic::{AtomicBool, Ordering},
|
|
15
|
+
},
|
|
16
|
+
time::Duration,
|
|
17
|
+
};
|
|
18
|
+
use temporalio_client::{WfClientExt, WorkflowClientTrait, WorkflowOptions};
|
|
19
|
+
use temporalio_common::{
|
|
20
|
+
Worker, prost_dur,
|
|
21
|
+
protos::{
|
|
22
|
+
coresdk::{
|
|
23
|
+
AsJsonPayloadExt, IntoCompletion,
|
|
24
|
+
activity_task::activity_task as act_task,
|
|
25
|
+
workflow_activation::{FireTimer, WorkflowActivationJob, workflow_activation_job},
|
|
26
|
+
workflow_commands::{ActivityCancellationType, RequestCancelActivity, StartTimer},
|
|
27
|
+
workflow_completion::WorkflowActivationCompletion,
|
|
28
|
+
},
|
|
29
|
+
temporal::api::enums::v1::EventType,
|
|
30
|
+
test_utils::schedule_activity_cmd,
|
|
31
|
+
},
|
|
32
|
+
telemetry::{Logger, TelemetryOptionsBuilder},
|
|
33
|
+
worker::PollerBehavior,
|
|
34
|
+
};
|
|
35
|
+
use temporalio_sdk::{ActivityOptions, WfContext};
|
|
36
|
+
use temporalio_sdk_core::{
|
|
37
|
+
ClientOptions, CoreRuntime, RuntimeOptionsBuilder,
|
|
38
|
+
ephemeral_server::{TemporalDevServerConfigBuilder, default_cached_download},
|
|
39
|
+
init_worker,
|
|
40
|
+
telemetry::CoreLogStreamConsumer,
|
|
41
|
+
test_help::{NAMESPACE, WorkerTestHelpers, drain_pollers_and_shutdown},
|
|
42
|
+
};
|
|
43
|
+
use tokio::{sync::Notify, time::timeout};
|
|
44
|
+
use tracing::info;
|
|
45
|
+
use url::Url;
|
|
46
|
+
|
|
47
|
+
#[tokio::test]
|
|
48
|
+
async fn out_of_order_completion_doesnt_hang() {
|
|
49
|
+
let mut starter = init_core_and_create_wf("out_of_order_completion_doesnt_hang").await;
|
|
50
|
+
let core = starter.get_worker().await;
|
|
51
|
+
let task_q = starter.get_task_queue();
|
|
52
|
+
let activity_id = "act-1";
|
|
53
|
+
let task = core.poll_workflow_activation().await.unwrap();
|
|
54
|
+
// Complete workflow task and schedule activity and a timer that fires immediately
|
|
55
|
+
core.complete_workflow_activation(
|
|
56
|
+
vec![
|
|
57
|
+
schedule_activity_cmd(
|
|
58
|
+
0,
|
|
59
|
+
task_q,
|
|
60
|
+
activity_id,
|
|
61
|
+
ActivityCancellationType::TryCancel,
|
|
62
|
+
Duration::from_secs(60),
|
|
63
|
+
Duration::from_secs(60),
|
|
64
|
+
),
|
|
65
|
+
StartTimer {
|
|
66
|
+
seq: 1,
|
|
67
|
+
start_to_fire_timeout: Some(prost_dur!(from_millis(50))),
|
|
68
|
+
}
|
|
69
|
+
.into(),
|
|
70
|
+
]
|
|
71
|
+
.into_completion(task.run_id),
|
|
72
|
+
)
|
|
73
|
+
.await
|
|
74
|
+
.unwrap();
|
|
75
|
+
// Poll activity and verify that it's been scheduled, we don't expect to complete it in this
|
|
76
|
+
// test as activity is try-cancelled.
|
|
77
|
+
let activity_task = core.poll_activity_task().await.unwrap();
|
|
78
|
+
assert_matches!(activity_task.variant, Some(act_task::Variant::Start(_)));
|
|
79
|
+
// Poll workflow task and verify that activity has failed.
|
|
80
|
+
let task = core.poll_workflow_activation().await.unwrap();
|
|
81
|
+
assert_matches!(
|
|
82
|
+
task.jobs.as_slice(),
|
|
83
|
+
[
|
|
84
|
+
WorkflowActivationJob {
|
|
85
|
+
variant: Some(workflow_activation_job::Variant::FireTimer(
|
|
86
|
+
FireTimer { seq: t_seq }
|
|
87
|
+
)),
|
|
88
|
+
},
|
|
89
|
+
] => {
|
|
90
|
+
assert_eq!(*t_seq, 1);
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
// Start polling again *before* we complete the WFT
|
|
95
|
+
let cc = core.clone();
|
|
96
|
+
let jh = tokio::spawn(async move {
|
|
97
|
+
// We want to fail the test if this takes too long -- we should not hit long poll timeout
|
|
98
|
+
let task = timeout(Duration::from_secs(1), cc.poll_workflow_activation())
|
|
99
|
+
.await
|
|
100
|
+
.expect("Poll should come back right away")
|
|
101
|
+
.unwrap();
|
|
102
|
+
assert_matches!(
|
|
103
|
+
task.jobs.as_slice(),
|
|
104
|
+
[WorkflowActivationJob {
|
|
105
|
+
variant: Some(workflow_activation_job::Variant::ResolveActivity(_)),
|
|
106
|
+
}]
|
|
107
|
+
);
|
|
108
|
+
cc.complete_execution(&task.run_id).await;
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
tokio::time::sleep(Duration::from_millis(100)).await;
|
|
112
|
+
// Then complete the (last) WFT with a request to cancel the AT, which should produce a
|
|
113
|
+
// pending activation, unblocking the (already started) poll
|
|
114
|
+
core.complete_workflow_activation(WorkflowActivationCompletion::from_cmds(
|
|
115
|
+
task.run_id,
|
|
116
|
+
vec![RequestCancelActivity { seq: 0 }.into()],
|
|
117
|
+
))
|
|
118
|
+
.await
|
|
119
|
+
.unwrap();
|
|
120
|
+
|
|
121
|
+
jh.await.unwrap();
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
#[tokio::test]
|
|
125
|
+
async fn switching_worker_client_changes_poll() {
|
|
126
|
+
// Start two servers
|
|
127
|
+
info!("Starting servers");
|
|
128
|
+
let server_config = TemporalDevServerConfigBuilder::default()
|
|
129
|
+
.exe(default_cached_download())
|
|
130
|
+
// We need to lower the poll timeout so the poll call rolls over
|
|
131
|
+
.extra_args(vec![
|
|
132
|
+
"--dynamic-config-value".to_string(),
|
|
133
|
+
"matching.longPollExpirationInterval=\"1s\"".to_string(),
|
|
134
|
+
])
|
|
135
|
+
.build()
|
|
136
|
+
.unwrap();
|
|
137
|
+
let mut server1 = server_config
|
|
138
|
+
.start_server_with_output(Stdio::null(), Stdio::null())
|
|
139
|
+
.await
|
|
140
|
+
.unwrap();
|
|
141
|
+
let mut server2 = server_config
|
|
142
|
+
.start_server_with_output(Stdio::null(), Stdio::null())
|
|
143
|
+
.await
|
|
144
|
+
.unwrap();
|
|
145
|
+
|
|
146
|
+
let result = std::panic::AssertUnwindSafe(async {
|
|
147
|
+
// Connect clients to both servers
|
|
148
|
+
info!("Connecting clients");
|
|
149
|
+
let client1 = ClientOptions::builder()
|
|
150
|
+
.identity("integ_tester".to_owned())
|
|
151
|
+
.client_name("temporal-core".to_owned())
|
|
152
|
+
.client_version("0.1.0".to_owned())
|
|
153
|
+
.target_url(Url::parse(&format!("http://{}", server1.target)).unwrap())
|
|
154
|
+
.build()
|
|
155
|
+
.connect("default", None)
|
|
156
|
+
.await
|
|
157
|
+
.unwrap();
|
|
158
|
+
let client2 = ClientOptions::builder()
|
|
159
|
+
.identity("integ_tester".to_owned())
|
|
160
|
+
.client_name("temporal-core".to_owned())
|
|
161
|
+
.client_version("0.1.0".to_owned())
|
|
162
|
+
.target_url(Url::parse(&format!("http://{}", server2.target)).unwrap())
|
|
163
|
+
.build()
|
|
164
|
+
.connect("default", None)
|
|
165
|
+
.await
|
|
166
|
+
.unwrap();
|
|
167
|
+
|
|
168
|
+
// Start a workflow on both servers
|
|
169
|
+
info!("Starting workflows");
|
|
170
|
+
let wf1 = client1
|
|
171
|
+
.start_workflow(
|
|
172
|
+
vec![],
|
|
173
|
+
"my-task-queue".to_owned(),
|
|
174
|
+
"my-workflow-1".to_owned(),
|
|
175
|
+
"my-workflow-type".to_owned(),
|
|
176
|
+
None,
|
|
177
|
+
WorkflowOptions::default(),
|
|
178
|
+
)
|
|
179
|
+
.await
|
|
180
|
+
.unwrap();
|
|
181
|
+
let wf2 = client2
|
|
182
|
+
.start_workflow(
|
|
183
|
+
vec![],
|
|
184
|
+
"my-task-queue".to_owned(),
|
|
185
|
+
"my-workflow-2".to_owned(),
|
|
186
|
+
"my-workflow-type".to_owned(),
|
|
187
|
+
None,
|
|
188
|
+
WorkflowOptions::default(),
|
|
189
|
+
)
|
|
190
|
+
.await
|
|
191
|
+
.unwrap();
|
|
192
|
+
|
|
193
|
+
// Create a worker only on the first server
|
|
194
|
+
let worker = init_worker(
|
|
195
|
+
init_integ_telem().unwrap(),
|
|
196
|
+
integ_worker_config("my-task-queue")
|
|
197
|
+
// We want a cache so we don't get extra remove-job activations
|
|
198
|
+
.max_cached_workflows(100_usize)
|
|
199
|
+
.build()
|
|
200
|
+
.unwrap(),
|
|
201
|
+
client1.clone(),
|
|
202
|
+
)
|
|
203
|
+
.unwrap();
|
|
204
|
+
|
|
205
|
+
// Poll for first task, confirm it's first wf, complete, and wait for complete
|
|
206
|
+
info!("Doing initial poll");
|
|
207
|
+
let act1 = worker.poll_workflow_activation().await.unwrap();
|
|
208
|
+
assert_eq!(wf1.run_id, act1.run_id);
|
|
209
|
+
worker.complete_execution(&act1.run_id).await;
|
|
210
|
+
worker.handle_eviction().await;
|
|
211
|
+
info!("Waiting on first workflow complete");
|
|
212
|
+
client1
|
|
213
|
+
.get_untyped_workflow_handle("my-workflow-1", wf1.run_id)
|
|
214
|
+
.get_workflow_result(Default::default())
|
|
215
|
+
.await
|
|
216
|
+
.unwrap();
|
|
217
|
+
|
|
218
|
+
// Swap client, poll for next task, confirm it's second wf, and respond w/ empty
|
|
219
|
+
info!("Replacing client and polling again");
|
|
220
|
+
worker
|
|
221
|
+
.replace_client(client2.get_client().inner().clone())
|
|
222
|
+
.unwrap();
|
|
223
|
+
let act2 = worker.poll_workflow_activation().await.unwrap();
|
|
224
|
+
assert_eq!(wf2.run_id, act2.run_id);
|
|
225
|
+
worker.complete_execution(&act2.run_id).await;
|
|
226
|
+
worker.handle_eviction().await;
|
|
227
|
+
info!("Waiting on second workflow complete");
|
|
228
|
+
client2
|
|
229
|
+
.get_untyped_workflow_handle("my-workflow-2", wf2.run_id)
|
|
230
|
+
.get_workflow_result(Default::default())
|
|
231
|
+
.await
|
|
232
|
+
.unwrap();
|
|
233
|
+
|
|
234
|
+
// Shutdown workers and servers
|
|
235
|
+
drain_pollers_and_shutdown(&(Arc::new(worker) as Arc<dyn Worker>)).await;
|
|
236
|
+
})
|
|
237
|
+
.catch_unwind()
|
|
238
|
+
.await;
|
|
239
|
+
|
|
240
|
+
let shutdown_results = join_all([server1.shutdown(), server2.shutdown()]).await;
|
|
241
|
+
if let Err(e) = result {
|
|
242
|
+
std::panic::resume_unwind(e);
|
|
243
|
+
}
|
|
244
|
+
for r in shutdown_results {
|
|
245
|
+
r.unwrap();
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
#[rstest::rstest]
|
|
250
|
+
#[tokio::test]
|
|
251
|
+
async fn small_workflow_slots_and_pollers(#[values(false, true)] use_autoscaling: bool) {
|
|
252
|
+
let wf_name = "only_one_workflow_slot_and_two_pollers";
|
|
253
|
+
let mut starter = CoreWfStarter::new(wf_name);
|
|
254
|
+
if use_autoscaling {
|
|
255
|
+
starter
|
|
256
|
+
.worker_config
|
|
257
|
+
.workflow_task_poller_behavior(PollerBehavior::Autoscaling {
|
|
258
|
+
minimum: 1,
|
|
259
|
+
maximum: 5,
|
|
260
|
+
initial: 1,
|
|
261
|
+
});
|
|
262
|
+
} else {
|
|
263
|
+
starter
|
|
264
|
+
.worker_config
|
|
265
|
+
.workflow_task_poller_behavior(PollerBehavior::SimpleMaximum(2));
|
|
266
|
+
}
|
|
267
|
+
starter
|
|
268
|
+
.worker_config
|
|
269
|
+
.max_outstanding_workflow_tasks(2_usize)
|
|
270
|
+
.max_outstanding_local_activities(1_usize)
|
|
271
|
+
.activity_task_poller_behavior(PollerBehavior::SimpleMaximum(1))
|
|
272
|
+
.max_outstanding_activities(1_usize);
|
|
273
|
+
let mut worker = starter.worker().await;
|
|
274
|
+
worker.register_wf(wf_name.to_owned(), |ctx: WfContext| async move {
|
|
275
|
+
for _ in 0..3 {
|
|
276
|
+
ctx.activity(ActivityOptions {
|
|
277
|
+
activity_type: "echo_activity".to_string(),
|
|
278
|
+
start_to_close_timeout: Some(Duration::from_secs(5)),
|
|
279
|
+
input: "hi!".as_json_payload().expect("serializes fine"),
|
|
280
|
+
..Default::default()
|
|
281
|
+
})
|
|
282
|
+
.await;
|
|
283
|
+
}
|
|
284
|
+
Ok(().into())
|
|
285
|
+
});
|
|
286
|
+
worker.register_activity("echo_activity", echo);
|
|
287
|
+
worker
|
|
288
|
+
.submit_wf(
|
|
289
|
+
starter.get_task_queue(),
|
|
290
|
+
wf_name.to_owned(),
|
|
291
|
+
vec![],
|
|
292
|
+
WorkflowOptions::default(),
|
|
293
|
+
)
|
|
294
|
+
.await
|
|
295
|
+
.unwrap();
|
|
296
|
+
let wf2id = format!("{}-2", starter.get_task_queue());
|
|
297
|
+
worker
|
|
298
|
+
.submit_wf(
|
|
299
|
+
wf2id.clone(),
|
|
300
|
+
wf_name.to_owned(),
|
|
301
|
+
vec![],
|
|
302
|
+
WorkflowOptions::default(),
|
|
303
|
+
)
|
|
304
|
+
.await
|
|
305
|
+
.unwrap();
|
|
306
|
+
// If we don't fail the workflow on nondeterminism, we'll get stuck here retrying the WFT
|
|
307
|
+
worker.run_until_done().await.unwrap();
|
|
308
|
+
// Verify no task timeouts happened
|
|
309
|
+
let history = starter.get_history().await;
|
|
310
|
+
let any_task_timeouts = history
|
|
311
|
+
.events
|
|
312
|
+
.iter()
|
|
313
|
+
.any(|e| e.event_type() == EventType::WorkflowTaskTimedOut);
|
|
314
|
+
assert!(!any_task_timeouts);
|
|
315
|
+
let history = starter
|
|
316
|
+
.get_client()
|
|
317
|
+
.await
|
|
318
|
+
.get_workflow_execution_history(wf2id, None, vec![])
|
|
319
|
+
.await
|
|
320
|
+
.unwrap()
|
|
321
|
+
.history
|
|
322
|
+
.unwrap();
|
|
323
|
+
let any_task_timeouts = history
|
|
324
|
+
.events
|
|
325
|
+
.iter()
|
|
326
|
+
.any(|e| e.event_type() == EventType::WorkflowTaskTimedOut);
|
|
327
|
+
assert!(!any_task_timeouts);
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
#[tokio::test]
|
|
331
|
+
async fn replace_client_works_after_polling_failure() {
|
|
332
|
+
let (log_consumer, mut log_rx) = CoreLogStreamConsumer::new(100);
|
|
333
|
+
let telem_opts = TelemetryOptionsBuilder::default()
|
|
334
|
+
.logging(Logger::Push {
|
|
335
|
+
filter: "OFF,temporalio_client=DEBUG".into(),
|
|
336
|
+
consumer: Arc::new(log_consumer),
|
|
337
|
+
})
|
|
338
|
+
.build()
|
|
339
|
+
.unwrap();
|
|
340
|
+
let runtime_opts = RuntimeOptionsBuilder::default()
|
|
341
|
+
.telemetry_options(telem_opts)
|
|
342
|
+
.build()
|
|
343
|
+
.unwrap();
|
|
344
|
+
let rt = Arc::new(CoreRuntime::new_assume_tokio(runtime_opts).unwrap());
|
|
345
|
+
|
|
346
|
+
// Spawning background task to read logs and notify the test when polling failure occurs.
|
|
347
|
+
let look_for_poll_failure_log = Arc::new(AtomicBool::new(false));
|
|
348
|
+
let poll_retry_log_found = Arc::new(Notify::new());
|
|
349
|
+
let log_reader_join_handle = tokio::spawn({
|
|
350
|
+
let look_for_poll_retry_log = look_for_poll_failure_log.clone();
|
|
351
|
+
let poll_retry_log_found = poll_retry_log_found.clone();
|
|
352
|
+
async move {
|
|
353
|
+
let mut enabled = false;
|
|
354
|
+
loop {
|
|
355
|
+
let Some(log) = log_rx.next().await else {
|
|
356
|
+
break;
|
|
357
|
+
};
|
|
358
|
+
if !enabled {
|
|
359
|
+
enabled = look_for_poll_retry_log.load(Ordering::Acquire);
|
|
360
|
+
}
|
|
361
|
+
if enabled
|
|
362
|
+
&& (log
|
|
363
|
+
.message
|
|
364
|
+
.starts_with("gRPC call poll_workflow_task_queue failed")
|
|
365
|
+
|| log
|
|
366
|
+
.message
|
|
367
|
+
.starts_with("gRPC call poll_workflow_task_queue retried"))
|
|
368
|
+
{
|
|
369
|
+
poll_retry_log_found.notify_one();
|
|
370
|
+
break;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
});
|
|
375
|
+
let abort_handles = Arc::new(Mutex::new(vec![log_reader_join_handle.abort_handle()]));
|
|
376
|
+
|
|
377
|
+
// Starting a second dev server for the worker to connect to initially. Later this server will be shut down
|
|
378
|
+
// and the worker client replaced with a client connected to the main integration test server.
|
|
379
|
+
let initial_server_config = integ_dev_server_config(vec![]).build().unwrap();
|
|
380
|
+
let initial_server = Arc::new(Mutex::new(Some(
|
|
381
|
+
initial_server_config
|
|
382
|
+
.start_server_with_output(Stdio::null(), Stdio::null())
|
|
383
|
+
.await
|
|
384
|
+
.unwrap(),
|
|
385
|
+
)));
|
|
386
|
+
|
|
387
|
+
let result = {
|
|
388
|
+
let initial_server = initial_server.clone();
|
|
389
|
+
let abort_handles = abort_handles.clone();
|
|
390
|
+
std::panic::AssertUnwindSafe(async move {
|
|
391
|
+
let initial_server_target = format!(
|
|
392
|
+
"http://{}",
|
|
393
|
+
initial_server.lock().unwrap().as_ref().unwrap().target
|
|
394
|
+
);
|
|
395
|
+
let client_for_initial_server = ClientOptions::builder()
|
|
396
|
+
.identity("client_for_initial_server".to_string())
|
|
397
|
+
.target_url(Url::parse(&initial_server_target).unwrap())
|
|
398
|
+
.client_name(INTEG_CLIENT_NAME.to_string())
|
|
399
|
+
.client_version(INTEG_CLIENT_VERSION.to_string())
|
|
400
|
+
.build()
|
|
401
|
+
.connect(NAMESPACE, rt.telemetry().get_temporal_metric_meter())
|
|
402
|
+
.await
|
|
403
|
+
.unwrap();
|
|
404
|
+
|
|
405
|
+
let wf_name = "replace_client_works_after_polling_failure";
|
|
406
|
+
let task_queue = format!("{wf_name}_tq");
|
|
407
|
+
|
|
408
|
+
let worker = Arc::new(
|
|
409
|
+
init_worker(
|
|
410
|
+
&rt,
|
|
411
|
+
integ_worker_config(&task_queue)
|
|
412
|
+
.max_cached_workflows(100_usize)
|
|
413
|
+
.build()
|
|
414
|
+
.unwrap(),
|
|
415
|
+
client_for_initial_server.clone(),
|
|
416
|
+
)
|
|
417
|
+
.unwrap(),
|
|
418
|
+
);
|
|
419
|
+
|
|
420
|
+
// Polling the initial server the first time is successful.
|
|
421
|
+
let wf_1 = client_for_initial_server
|
|
422
|
+
.start_workflow(
|
|
423
|
+
vec![],
|
|
424
|
+
task_queue.clone(),
|
|
425
|
+
wf_name.into(),
|
|
426
|
+
wf_name.into(),
|
|
427
|
+
None,
|
|
428
|
+
WorkflowOptions::default(),
|
|
429
|
+
)
|
|
430
|
+
.await
|
|
431
|
+
.unwrap();
|
|
432
|
+
let act_1 =
|
|
433
|
+
tokio::time::timeout(Duration::from_secs(60), worker.poll_workflow_activation())
|
|
434
|
+
.await
|
|
435
|
+
.unwrap()
|
|
436
|
+
.unwrap();
|
|
437
|
+
assert_eq!(act_1.run_id, wf_1.run_id);
|
|
438
|
+
|
|
439
|
+
// Initial server is shut down.
|
|
440
|
+
let mut server = initial_server.lock().unwrap().take().unwrap();
|
|
441
|
+
server.shutdown().await.unwrap();
|
|
442
|
+
|
|
443
|
+
// Start polling in a background task.
|
|
444
|
+
look_for_poll_failure_log.store(true, Ordering::Release);
|
|
445
|
+
let poll_join_handle = tokio::spawn({
|
|
446
|
+
let worker = worker.clone();
|
|
447
|
+
async move { worker.poll_workflow_activation().await }
|
|
448
|
+
});
|
|
449
|
+
abort_handles
|
|
450
|
+
.try_lock()
|
|
451
|
+
.unwrap()
|
|
452
|
+
.push(poll_join_handle.abort_handle());
|
|
453
|
+
|
|
454
|
+
// Wait until polling failure is detected.
|
|
455
|
+
tokio::time::timeout(Duration::from_secs(60), poll_retry_log_found.notified())
|
|
456
|
+
.await
|
|
457
|
+
.unwrap();
|
|
458
|
+
|
|
459
|
+
// Start a new WF on main integration server.
|
|
460
|
+
let client_for_integ_server = get_integ_server_options()
|
|
461
|
+
.connect(NAMESPACE, rt.telemetry().get_temporal_metric_meter())
|
|
462
|
+
.await
|
|
463
|
+
.unwrap();
|
|
464
|
+
let wf_2 = client_for_integ_server
|
|
465
|
+
.start_workflow(
|
|
466
|
+
vec![],
|
|
467
|
+
task_queue,
|
|
468
|
+
wf_name.into(),
|
|
469
|
+
wf_name.into(),
|
|
470
|
+
None,
|
|
471
|
+
WorkflowOptions {
|
|
472
|
+
execution_timeout: Some(Duration::from_secs(60)),
|
|
473
|
+
..Default::default()
|
|
474
|
+
},
|
|
475
|
+
)
|
|
476
|
+
.await
|
|
477
|
+
.unwrap();
|
|
478
|
+
|
|
479
|
+
// Switch worker over to the main integration server.
|
|
480
|
+
// The polling started on the initial server should complete with a task from the new server.
|
|
481
|
+
worker.replace_client(client_for_integ_server).unwrap();
|
|
482
|
+
let act_2 = tokio::time::timeout(Duration::from_secs(60), poll_join_handle)
|
|
483
|
+
.await
|
|
484
|
+
.unwrap()
|
|
485
|
+
.unwrap()
|
|
486
|
+
.unwrap();
|
|
487
|
+
assert_eq!(act_2.run_id, wf_2.run_id);
|
|
488
|
+
})
|
|
489
|
+
}
|
|
490
|
+
.catch_unwind()
|
|
491
|
+
.await;
|
|
492
|
+
|
|
493
|
+
// Cleaning up spawned background tasks if they're still running.
|
|
494
|
+
for handle in &*abort_handles.lock().unwrap() {
|
|
495
|
+
handle.abort();
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
// If the test panicked, we may or may not need to shut down the server here.
|
|
499
|
+
// If the test succeeded, the server should always be shut down by this point.
|
|
500
|
+
let server = initial_server.lock().unwrap().take();
|
|
501
|
+
if let Some(mut server) = server {
|
|
502
|
+
let _ = server.shutdown().await;
|
|
503
|
+
assert_matches!(
|
|
504
|
+
result,
|
|
505
|
+
Err(_),
|
|
506
|
+
"Server should have been shut down during the test"
|
|
507
|
+
);
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
if let Err(e) = result {
|
|
511
|
+
std::panic::resume_unwind(e);
|
|
512
|
+
}
|
|
513
|
+
}
|
|
@@ -1,19 +1,21 @@
|
|
|
1
|
+
use crate::common::{CoreWfStarter, init_core_and_create_wf};
|
|
1
2
|
use assert_matches::assert_matches;
|
|
2
3
|
use futures_util::{FutureExt, StreamExt, future::join_all, stream::FuturesUnordered};
|
|
3
4
|
use std::time::{Duration, Instant};
|
|
4
|
-
use
|
|
5
|
-
use
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
use temporalio_client::WorkflowClientTrait;
|
|
6
|
+
use temporalio_common::{
|
|
7
|
+
prost_dur,
|
|
8
|
+
protos::{
|
|
9
|
+
coresdk::{
|
|
10
|
+
workflow_activation::{WorkflowActivationJob, workflow_activation_job},
|
|
11
|
+
workflow_commands::{QueryResult, QuerySuccess, StartTimer},
|
|
12
|
+
workflow_completion::WorkflowActivationCompletion,
|
|
13
|
+
},
|
|
14
|
+
temporal::api::{failure::v1::Failure, query::v1::WorkflowQuery},
|
|
15
|
+
test_utils::start_timer_cmd,
|
|
10
16
|
},
|
|
11
|
-
temporal::api::{failure::v1::Failure, query::v1::WorkflowQuery},
|
|
12
|
-
};
|
|
13
|
-
use temporal_sdk_core_test_utils::{
|
|
14
|
-
CoreWfStarter, WorkerTestHelpers, drain_pollers_and_shutdown, init_core_and_create_wf,
|
|
15
|
-
start_timer_cmd,
|
|
16
17
|
};
|
|
18
|
+
use temporalio_sdk_core::test_help::{WorkerTestHelpers, drain_pollers_and_shutdown};
|
|
17
19
|
use tokio::join;
|
|
18
20
|
|
|
19
21
|
#[tokio::test]
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
use crate::common::{
|
|
2
|
+
CoreWfStarter, WorkflowHandleExt, init_core_and_create_wf, init_core_replay_preloaded,
|
|
3
|
+
};
|
|
1
4
|
use anyhow::anyhow;
|
|
2
5
|
use assert_matches::assert_matches;
|
|
3
6
|
use futures_util::{StreamExt, future, future::join_all};
|
|
@@ -8,36 +11,40 @@ use std::{
|
|
|
8
11
|
},
|
|
9
12
|
time::Duration,
|
|
10
13
|
};
|
|
11
|
-
use
|
|
14
|
+
use temporalio_client::{
|
|
12
15
|
Client, NamespacedClient, RetryClient, WorkflowClientTrait, WorkflowService,
|
|
13
16
|
};
|
|
14
|
-
use
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
use temporalio_common::{
|
|
18
|
+
Worker, prost_dur,
|
|
19
|
+
protos::{
|
|
20
|
+
coresdk::{
|
|
21
|
+
ActivityTaskCompletion, AsJsonPayloadExt, IntoPayloadsExt,
|
|
22
|
+
activity_result::ActivityExecutionResult,
|
|
23
|
+
workflow_activation::{
|
|
24
|
+
WorkflowActivationJob, remove_from_cache::EvictionReason, workflow_activation_job,
|
|
25
|
+
},
|
|
26
|
+
workflow_commands::{
|
|
27
|
+
CompleteWorkflowExecution, ScheduleLocalActivity, UpdateResponse, update_response,
|
|
28
|
+
},
|
|
29
|
+
workflow_completion::WorkflowActivationCompletion,
|
|
23
30
|
},
|
|
24
|
-
|
|
25
|
-
|
|
31
|
+
temporal::api::{
|
|
32
|
+
common::v1::WorkflowExecution,
|
|
33
|
+
enums::v1::{EventType, ResetReapplyType, UpdateWorkflowExecutionLifecycleStage},
|
|
34
|
+
update::{self, v1::WaitPolicy},
|
|
35
|
+
workflowservice::v1::ResetWorkflowExecutionRequest,
|
|
26
36
|
},
|
|
27
|
-
|
|
28
|
-
},
|
|
29
|
-
temporal::api::{
|
|
30
|
-
common::v1::WorkflowExecution,
|
|
31
|
-
enums::v1::{EventType, ResetReapplyType, UpdateWorkflowExecutionLifecycleStage},
|
|
32
|
-
update::{self, v1::WaitPolicy},
|
|
33
|
-
workflowservice::v1::ResetWorkflowExecutionRequest,
|
|
37
|
+
test_utils::start_timer_cmd,
|
|
34
38
|
},
|
|
39
|
+
worker::WorkerTaskTypes,
|
|
35
40
|
};
|
|
36
|
-
use
|
|
37
|
-
|
|
38
|
-
|
|
41
|
+
use temporalio_sdk::{ActContext, ActivityOptions, LocalActivityOptions, UpdateContext, WfContext};
|
|
42
|
+
use temporalio_sdk_core::{
|
|
43
|
+
replay::HistoryForReplay,
|
|
44
|
+
test_help::{WorkerTestHelpers, drain_pollers_and_shutdown},
|
|
39
45
|
};
|
|
40
46
|
use tokio::{join, sync::Barrier};
|
|
47
|
+
use tonic::IntoRequest;
|
|
41
48
|
use uuid::Uuid;
|
|
42
49
|
|
|
43
50
|
#[derive(Clone, Copy)]
|
|
@@ -112,7 +119,7 @@ async fn reapplied_updates_due_to_reset() {
|
|
|
112
119
|
Arc::make_mut(&mut client_mut),
|
|
113
120
|
#[allow(deprecated)]
|
|
114
121
|
ResetWorkflowExecutionRequest {
|
|
115
|
-
namespace: client.namespace()
|
|
122
|
+
namespace: client.namespace(),
|
|
116
123
|
workflow_execution: Some(WorkflowExecution {
|
|
117
124
|
workflow_id: workflow_id.into(),
|
|
118
125
|
run_id: pre_reset_run_id.clone(),
|
|
@@ -121,7 +128,8 @@ async fn reapplied_updates_due_to_reset() {
|
|
|
121
128
|
reset_reapply_type: ResetReapplyType::AllEligible as i32,
|
|
122
129
|
request_id: Uuid::new_v4().to_string(),
|
|
123
130
|
..Default::default()
|
|
124
|
-
}
|
|
131
|
+
}
|
|
132
|
+
.into_request(),
|
|
125
133
|
)
|
|
126
134
|
.await
|
|
127
135
|
.unwrap()
|
|
@@ -716,7 +724,9 @@ async fn update_with_local_acts() {
|
|
|
716
724
|
async fn update_rejection_sdk() {
|
|
717
725
|
let wf_name = "update_rejection_sdk";
|
|
718
726
|
let mut starter = CoreWfStarter::new(wf_name);
|
|
719
|
-
starter
|
|
727
|
+
starter
|
|
728
|
+
.worker_config
|
|
729
|
+
.task_types(WorkerTaskTypes::workflow_only());
|
|
720
730
|
let mut worker = starter.worker().await;
|
|
721
731
|
let client = starter.get_client().await;
|
|
722
732
|
worker.register_wf(wf_name.to_owned(), |ctx: WfContext| async move {
|
|
@@ -760,7 +770,9 @@ async fn update_rejection_sdk() {
|
|
|
760
770
|
async fn update_fail_sdk() {
|
|
761
771
|
let wf_name = "update_fail_sdk";
|
|
762
772
|
let mut starter = CoreWfStarter::new(wf_name);
|
|
763
|
-
starter
|
|
773
|
+
starter
|
|
774
|
+
.worker_config
|
|
775
|
+
.task_types(WorkerTaskTypes::workflow_only());
|
|
764
776
|
let mut worker = starter.worker().await;
|
|
765
777
|
let client = starter.get_client().await;
|
|
766
778
|
worker.register_wf(wf_name.to_owned(), |ctx: WfContext| async move {
|
|
@@ -804,7 +816,9 @@ async fn update_fail_sdk() {
|
|
|
804
816
|
async fn update_timer_sequence() {
|
|
805
817
|
let wf_name = "update_timer_sequence";
|
|
806
818
|
let mut starter = CoreWfStarter::new(wf_name);
|
|
807
|
-
starter
|
|
819
|
+
starter
|
|
820
|
+
.worker_config
|
|
821
|
+
.task_types(WorkerTaskTypes::workflow_only());
|
|
808
822
|
let mut worker = starter.worker().await;
|
|
809
823
|
let client = starter.get_client().await;
|
|
810
824
|
worker.register_wf(wf_name.to_owned(), |ctx: WfContext| async move {
|
|
@@ -852,7 +866,9 @@ async fn update_timer_sequence() {
|
|
|
852
866
|
async fn task_failure_during_validation() {
|
|
853
867
|
let wf_name = "task_failure_during_validation";
|
|
854
868
|
let mut starter = CoreWfStarter::new(wf_name);
|
|
855
|
-
starter
|
|
869
|
+
starter
|
|
870
|
+
.worker_config
|
|
871
|
+
.task_types(WorkerTaskTypes::workflow_only());
|
|
856
872
|
starter.workflow_options.task_timeout = Some(Duration::from_secs(1));
|
|
857
873
|
let mut worker = starter.worker().await;
|
|
858
874
|
let client = starter.get_client().await;
|
|
@@ -913,7 +929,9 @@ async fn task_failure_during_validation() {
|
|
|
913
929
|
async fn task_failure_after_update() {
|
|
914
930
|
let wf_name = "task_failure_after_update";
|
|
915
931
|
let mut starter = CoreWfStarter::new(wf_name);
|
|
916
|
-
starter
|
|
932
|
+
starter
|
|
933
|
+
.worker_config
|
|
934
|
+
.task_types(WorkerTaskTypes::workflow_only());
|
|
917
935
|
starter.workflow_options.task_timeout = Some(Duration::from_secs(1));
|
|
918
936
|
let mut worker = starter.worker().await;
|
|
919
937
|
let client = starter.get_client().await;
|