@temporalio/core-bridge 1.7.0 → 1.7.2
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 +500 -400
- package/package.json +3 -3
- 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/client/src/lib.rs +23 -6
- package/sdk-core/client/src/raw.rs +15 -6
- package/sdk-core/core/Cargo.toml +1 -0
- package/sdk-core/core/src/core_tests/activity_tasks.rs +13 -5
- package/sdk-core/core/src/core_tests/determinism.rs +49 -2
- package/sdk-core/core/src/core_tests/workflow_tasks.rs +21 -39
- package/sdk-core/core/src/internal_flags.rs +132 -60
- package/sdk-core/core/src/worker/activities/activity_task_poller_stream.rs +10 -7
- package/sdk-core/core/src/worker/activities.rs +152 -142
- package/sdk-core/core/src/worker/client.rs +12 -8
- package/sdk-core/core/src/worker/mod.rs +8 -5
- package/sdk-core/core/src/worker/workflow/history_update.rs +86 -2
- package/sdk-core/core/src/worker/workflow/machines/signal_external_state_machine.rs +4 -1
- package/sdk-core/core/src/worker/workflow/machines/upsert_search_attributes_state_machine.rs +23 -88
- package/sdk-core/core/src/worker/workflow/machines/workflow_machines.rs +6 -6
- package/sdk-core/core/src/worker/workflow/managed_run.rs +9 -2
- package/sdk-core/core/src/worker/workflow/mod.rs +22 -8
- package/sdk-core/core/src/worker/workflow/workflow_stream.rs +29 -27
- package/sdk-core/protos/api_upstream/.github/workflows/publish-docs.yml +23 -0
- package/sdk-core/protos/api_upstream/Makefile +1 -1
- package/sdk-core/protos/api_upstream/buf.yaml +5 -0
- package/sdk-core/protos/api_upstream/temporal/api/common/v1/message.proto +17 -0
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/failed_cause.proto +2 -0
- package/sdk-core/protos/api_upstream/temporal/api/history/v1/message.proto +6 -3
- package/sdk-core/protos/api_upstream/temporal/api/protocol/v1/message.proto +1 -1
- package/sdk-core/protos/api_upstream/temporal/api/taskqueue/v1/message.proto +12 -22
- package/sdk-core/protos/api_upstream/temporal/api/update/v1/message.proto +2 -2
- package/sdk-core/protos/api_upstream/temporal/api/workflow/v1/message.proto +2 -0
- package/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto +145 -48
- package/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/service.proto +19 -8
- package/sdk-core/test-utils/src/lib.rs +29 -7
- package/sdk-core/tests/integ_tests/activity_functions.rs +5 -0
- package/sdk-core/tests/integ_tests/workflow_tests/activities.rs +2 -4
- package/sdk-core/tests/integ_tests/workflow_tests/determinism.rs +0 -1
- package/sdk-core/tests/integ_tests/workflow_tests/local_activities.rs +5 -7
- package/sdk-core/tests/integ_tests/workflow_tests.rs +3 -7
- package/sdk-core/tests/main.rs +16 -24
|
@@ -180,6 +180,10 @@ message StartWorkflowExecutionRequest {
|
|
|
180
180
|
// StartWorkflowExecution.
|
|
181
181
|
temporal.api.failure.v1.Failure continued_failure = 18;
|
|
182
182
|
temporal.api.common.v1.Payloads last_completion_result = 19;
|
|
183
|
+
// Time to wait before dispatching the first workflow task. Cannot be used with `cron_schedule`.
|
|
184
|
+
// If the workflow gets a signal before the delay, a workflow task will be dispatched and the rest
|
|
185
|
+
// of the delay will be ignored.
|
|
186
|
+
google.protobuf.Duration workflow_start_delay = 20 [(gogoproto.stdduration) = true];
|
|
183
187
|
}
|
|
184
188
|
|
|
185
189
|
message StartWorkflowExecutionResponse {
|
|
@@ -237,12 +241,12 @@ message PollWorkflowTaskQueueRequest {
|
|
|
237
241
|
// Each worker process should provide an ID unique to the specific set of code it is running
|
|
238
242
|
// "checksum" in this field name isn't very accurate, it should be though of as an id.
|
|
239
243
|
string binary_checksum = 4;
|
|
240
|
-
// If set, the worker is opting in to
|
|
241
|
-
// receive tasks that are considered compatible with the version provided.
|
|
242
|
-
// Doing so only makes sense in conjunction with the `
|
|
243
|
-
// When
|
|
244
|
+
// If set, the worker is opting in to versioning and wishes to only
|
|
245
|
+
// receive tasks that are considered compatible with the version capabilities provided.
|
|
246
|
+
// Doing so only makes sense in conjunction with the `UpdateWorkerBuildIdCompatibility` API.
|
|
247
|
+
// When this field has a `worker_build_id`, and `binary_checksum` is not
|
|
244
248
|
// set, that value should also be considered as the `binary_checksum`.
|
|
245
|
-
temporal.api.
|
|
249
|
+
temporal.api.common.v1.WorkerVersionCapabilities worker_version_capabilities = 5;
|
|
246
250
|
}
|
|
247
251
|
|
|
248
252
|
message PollWorkflowTaskQueueResponse {
|
|
@@ -310,11 +314,12 @@ message RespondWorkflowTaskCompletedRequest {
|
|
|
310
314
|
// Responses to the `queries` field in the task being responded to
|
|
311
315
|
map<string, temporal.api.query.v1.WorkflowQueryResult> query_results = 8;
|
|
312
316
|
string namespace = 9;
|
|
313
|
-
// If using versioning, worker
|
|
314
|
-
//
|
|
315
|
-
//
|
|
316
|
-
//
|
|
317
|
-
|
|
317
|
+
// If using versioning, the worker uses this field to indicate what version(s) it used to
|
|
318
|
+
// process the task. When this field has a `worker_build_id`, and `binary_checksum` is not set,
|
|
319
|
+
// that value should also be considered as the `binary_checksum`. Leaving this field empty when
|
|
320
|
+
// replying to a task has had this field previously populated in history in an error, and such
|
|
321
|
+
// a completion will be rejected.
|
|
322
|
+
temporal.api.common.v1.WorkerVersionStamp worker_version_stamp = 10;
|
|
318
323
|
// Protocol messages piggybacking on a WFT as a transport
|
|
319
324
|
repeated temporal.api.protocol.v1.Message messages = 11;
|
|
320
325
|
// Data the SDK wishes to record for itself, but server need not interpret, and does not
|
|
@@ -359,10 +364,10 @@ message PollActivityTaskQueueRequest {
|
|
|
359
364
|
// The identity of the worker/client
|
|
360
365
|
string identity = 3;
|
|
361
366
|
temporal.api.taskqueue.v1.TaskQueueMetadata task_queue_metadata = 4;
|
|
362
|
-
// If set, the worker is opting in to
|
|
363
|
-
// receive tasks that are considered compatible with the
|
|
364
|
-
// Doing so only makes sense in conjunction with the `
|
|
365
|
-
temporal.api.
|
|
367
|
+
// If set, the worker is opting in to versioning and wishes to only
|
|
368
|
+
// receive tasks that are considered compatible with the capabilities provided.
|
|
369
|
+
// Doing so only makes sense in conjunction with the `UpdateWorkerBuildIdCompatibility` API.
|
|
370
|
+
temporal.api.common.v1.WorkerVersionCapabilities worker_version_capabilities = 5;
|
|
366
371
|
}
|
|
367
372
|
|
|
368
373
|
message PollActivityTaskQueueResponse {
|
|
@@ -587,6 +592,8 @@ message SignalWorkflowExecutionRequest {
|
|
|
587
592
|
// Headers that are passed with the signal to the processing workflow.
|
|
588
593
|
// These can include things like auth or tracing tokens.
|
|
589
594
|
temporal.api.common.v1.Header header = 8;
|
|
595
|
+
// Indicates that a new workflow task should not be generated when this signal is received.
|
|
596
|
+
bool skip_generate_workflow_task = 9;
|
|
590
597
|
}
|
|
591
598
|
|
|
592
599
|
message SignalWorkflowExecutionResponse {
|
|
@@ -624,6 +631,15 @@ message SignalWithStartWorkflowExecutionRequest {
|
|
|
624
631
|
temporal.api.common.v1.Memo memo = 17;
|
|
625
632
|
temporal.api.common.v1.SearchAttributes search_attributes = 18;
|
|
626
633
|
temporal.api.common.v1.Header header = 19;
|
|
634
|
+
// Time to wait before dispatching the first workflow task. Cannot be used with `cron_schedule`.
|
|
635
|
+
// Note that the signal will be delivered with the first workflow task. If the workflow gets
|
|
636
|
+
// another SignalWithStartWorkflow before the delay and `skip_generate_workflow_task` is false
|
|
637
|
+
// or not set, a workflow task will be dispatched immediately and the rest of the delay period
|
|
638
|
+
// will be ignored, even if that request also had a delay. Signal via SignalWorkflowExecution
|
|
639
|
+
// will not unblock the workflow.
|
|
640
|
+
google.protobuf.Duration workflow_start_delay = 20 [(gogoproto.stdduration) = true];
|
|
641
|
+
// Indicates that a new workflow task should not be generated when this signal is received.
|
|
642
|
+
bool skip_generate_workflow_task = 21;
|
|
627
643
|
}
|
|
628
644
|
|
|
629
645
|
message SignalWithStartWorkflowExecutionResponse {
|
|
@@ -1038,47 +1054,106 @@ message ListSchedulesResponse {
|
|
|
1038
1054
|
}
|
|
1039
1055
|
|
|
1040
1056
|
// (-- api-linter: core::0134::request-mask-required=disabled
|
|
1041
|
-
// aip.dev/not-precedent:
|
|
1057
|
+
// aip.dev/not-precedent: UpdateWorkerBuildIdCompatibilityRequest doesn't follow Google API format --)
|
|
1042
1058
|
// (-- api-linter: core::0134::request-resource-required=disabled
|
|
1043
|
-
// aip.dev/not-precedent:
|
|
1044
|
-
message
|
|
1059
|
+
// aip.dev/not-precedent: UpdateWorkerBuildIdCompatibilityRequest RPC doesn't follow Google API format. --)
|
|
1060
|
+
message UpdateWorkerBuildIdCompatibilityRequest {
|
|
1061
|
+
message AddNewCompatibleVersion {
|
|
1062
|
+
// A new id to be added to an existing compatible set.
|
|
1063
|
+
string new_build_id = 1;
|
|
1064
|
+
// A build id which must already exist in the version sets known by the task queue. The new
|
|
1065
|
+
// id will be stored in the set containing this id, marking it as compatible with
|
|
1066
|
+
// the versions within.
|
|
1067
|
+
string existing_compatible_build_id = 2;
|
|
1068
|
+
// When set, establishes the compatible set being targeted as the overall default for the
|
|
1069
|
+
// queue. If a different set was the current default, the targeted set will replace it as
|
|
1070
|
+
// the new default.
|
|
1071
|
+
bool make_set_default = 3;
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1045
1074
|
string namespace = 1;
|
|
1046
|
-
// Must be set, the task queue to apply changes to. Because all workers on
|
|
1047
|
-
//
|
|
1048
|
-
//
|
|
1075
|
+
// Must be set, the task queue to apply changes to. Because all workers on a given task queue
|
|
1076
|
+
// must have the same set of workflow & activity implementations, there is no reason to specify
|
|
1077
|
+
// a task queue type here.
|
|
1049
1078
|
string task_queue = 2;
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1079
|
+
oneof operation {
|
|
1080
|
+
// A new build id. This operation will create a new set which will be the new overall
|
|
1081
|
+
// default version for the queue, with this id as its only member. This new set is
|
|
1082
|
+
// incompatible with all previous sets/versions.
|
|
1083
|
+
//
|
|
1084
|
+
// (-- api-linter: core::0140::prepositions=disabled
|
|
1085
|
+
// aip.dev/not-precedent: In makes perfect sense here. --)
|
|
1086
|
+
string add_new_build_id_in_new_default_set = 3;
|
|
1087
|
+
// Adds a new id to an existing compatible set, see sub-message definition for more.
|
|
1088
|
+
AddNewCompatibleVersion add_new_compatible_build_id = 4;
|
|
1089
|
+
// Promote an existing set to be the current default (if it isn't already) by targeting
|
|
1090
|
+
// an existing build id within it. This field's value is the extant build id.
|
|
1091
|
+
//
|
|
1092
|
+
// (-- api-linter: core::0140::prepositions=disabled
|
|
1093
|
+
// aip.dev/not-precedent: Names are hard. --)
|
|
1094
|
+
string promote_set_by_build_id = 5;
|
|
1095
|
+
// Promote an existing build id within some set to be the current default for that set.
|
|
1096
|
+
//
|
|
1097
|
+
// (-- api-linter: core::0140::prepositions=disabled
|
|
1098
|
+
// aip.dev/not-precedent: Within makes perfect sense here. --)
|
|
1099
|
+
string promote_build_id_within_set = 6;
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
message UpdateWorkerBuildIdCompatibilityResponse {
|
|
1103
|
+
// The id of the compatible set that the updated version was added to, or exists in. Users don't
|
|
1104
|
+
// need to understand or care about this value, but it has value for debugging purposes.
|
|
1105
|
+
string version_set_id = 1;
|
|
1106
|
+
}
|
|
1064
1107
|
|
|
1065
1108
|
// (-- api-linter: core::0134::request-resource-required=disabled
|
|
1066
|
-
// aip.dev/not-precedent:
|
|
1067
|
-
message
|
|
1109
|
+
// aip.dev/not-precedent: GetWorkerBuildIdCompatibilityRequest RPC doesn't follow Google API format. --)
|
|
1110
|
+
message GetWorkerBuildIdCompatibilityRequest {
|
|
1068
1111
|
string namespace = 1;
|
|
1069
|
-
// Must be set, the task queue to interrogate about worker id
|
|
1112
|
+
// Must be set, the task queue to interrogate about worker id compatibility.
|
|
1070
1113
|
string task_queue = 2;
|
|
1071
|
-
// Limits how
|
|
1072
|
-
// default
|
|
1073
|
-
int32
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
//
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1114
|
+
// Limits how many compatible sets will be returned. Specify 1 to only return the current
|
|
1115
|
+
// default major version set. 0 returns all sets.
|
|
1116
|
+
int32 max_sets = 3;
|
|
1117
|
+
// If set, the response will include information about worker versions which are ready to be
|
|
1118
|
+
// retired.
|
|
1119
|
+
bool include_retirement_candidates = 4;
|
|
1120
|
+
// If set, the response will include information about which versions have open workflows, and
|
|
1121
|
+
// whether or not there are currently polling workers who are compatible with those versions.
|
|
1122
|
+
bool include_poller_compatibility = 5;
|
|
1123
|
+
}
|
|
1124
|
+
message GetWorkerBuildIdCompatibilityResponse {
|
|
1125
|
+
// Major version sets, in order from oldest to newest. The last element of the list will always
|
|
1126
|
+
// be the current default major version. IE: New workflows will target the most recent version
|
|
1127
|
+
// in that version set.
|
|
1128
|
+
//
|
|
1129
|
+
// There may be fewer sets returned than exist, if the request chose to limit this response.
|
|
1130
|
+
repeated temporal.api.taskqueue.v1.CompatibleVersionSet major_version_sets = 1;
|
|
1131
|
+
|
|
1132
|
+
message RetirementCandidate {
|
|
1133
|
+
// The worker build id which is ready for retirement
|
|
1134
|
+
string build_id = 1;
|
|
1135
|
+
// If true, there are no open *or* closed workflows, meaning there is no reason at all
|
|
1136
|
+
// to keep the worker alive, not even to service queries on closed workflows. If not true,
|
|
1137
|
+
// then there are no open workflows, but some closed ones.
|
|
1138
|
+
bool all_workflows_are_archived = 2;
|
|
1139
|
+
// Currently polling workers who match the build id ready for retirement
|
|
1140
|
+
repeated temporal.api.taskqueue.v1.PollerInfo pollers = 3;
|
|
1141
|
+
}
|
|
1142
|
+
|
|
1143
|
+
// A list of workers who are still live and polling the task queue, but may no longer be needed
|
|
1144
|
+
// to make progress on open workflows.
|
|
1145
|
+
repeated RetirementCandidate retirement_candidates = 2;
|
|
1146
|
+
|
|
1147
|
+
message VersionsWithCompatiblePollers {
|
|
1148
|
+
// The latest build id which completed a workflow task on some open workflow
|
|
1149
|
+
string most_recent_build_id = 1;
|
|
1150
|
+
// Currently polling workers who are compatible with `most_recent_build_id`.
|
|
1151
|
+
repeated temporal.api.taskqueue.v1.PollerInfo pollers = 2;
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
// A list of versions and pollers who are capable of processing tasks at that version (if any)
|
|
1155
|
+
// for which there are currently open workflows.
|
|
1156
|
+
repeated VersionsWithCompatiblePollers active_versions_and_pollers = 3;
|
|
1082
1157
|
}
|
|
1083
1158
|
|
|
1084
1159
|
// (-- api-linter: core::0134=disabled
|
|
@@ -1197,3 +1272,25 @@ message ListBatchOperationsResponse {
|
|
|
1197
1272
|
repeated temporal.api.batch.v1.BatchOperationInfo operation_info = 1;
|
|
1198
1273
|
bytes next_page_token = 2;
|
|
1199
1274
|
}
|
|
1275
|
+
|
|
1276
|
+
message PollWorkflowExecutionUpdateRequest {
|
|
1277
|
+
// The namespace of the workflow execution to which the update was
|
|
1278
|
+
// originally issued.
|
|
1279
|
+
string namespace = 1;
|
|
1280
|
+
// The update reference returned in the initial
|
|
1281
|
+
// UpdateWorkflowExecutionResponse
|
|
1282
|
+
temporal.api.update.v1.UpdateRef update_ref = 2;
|
|
1283
|
+
// The identity of the worker/client who is polling this update outcome
|
|
1284
|
+
string identity = 3;
|
|
1285
|
+
// Describes when this poll request should return a response
|
|
1286
|
+
temporal.api.update.v1.WaitPolicy wait_policy = 4;
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1289
|
+
message PollWorkflowExecutionUpdateResponse {
|
|
1290
|
+
// The outcome of the update if and only if the update has completed. If
|
|
1291
|
+
// this response is being returned before the update has completed (e.g. due
|
|
1292
|
+
// to the specification of a wait policy that only waits on
|
|
1293
|
+
// UPDATE_WORKFLOW_EXECUTION_LIFECYCLE_STAGE_ACCEPTED) then this field will
|
|
1294
|
+
// not be set.
|
|
1295
|
+
temporal.api.update.v1.Outcome outcome = 1;
|
|
1296
|
+
}
|
|
@@ -380,16 +380,18 @@ service WorkflowService {
|
|
|
380
380
|
rpc ListSchedules (ListSchedulesRequest) returns (ListSchedulesResponse) {
|
|
381
381
|
}
|
|
382
382
|
|
|
383
|
-
// Allows users to specify
|
|
384
|
-
//
|
|
385
|
-
//
|
|
383
|
+
// Allows users to specify sets of worker build id versions on a per task queue basis. Versions
|
|
384
|
+
// are ordered, and may be either compatible with some extant version, or a new incompatible
|
|
385
|
+
// version, forming sets of ids which are incompatible with each other, but whose contained
|
|
386
|
+
// members are compatible with one another.
|
|
387
|
+
//
|
|
386
388
|
// (-- api-linter: core::0134::response-message-name=disabled
|
|
387
|
-
// aip.dev/not-precedent:
|
|
389
|
+
// aip.dev/not-precedent: UpdateWorkerBuildIdCompatibility RPC doesn't follow Google API format. --)
|
|
388
390
|
// (-- api-linter: core::0134::method-signature=disabled
|
|
389
|
-
// aip.dev/not-precedent:
|
|
390
|
-
rpc
|
|
391
|
-
// Fetches the worker build id versioning
|
|
392
|
-
rpc
|
|
391
|
+
// aip.dev/not-precedent: UpdateWorkerBuildIdCompatibility RPC doesn't follow Google API format. --)
|
|
392
|
+
rpc UpdateWorkerBuildIdCompatibility (UpdateWorkerBuildIdCompatibilityRequest) returns (UpdateWorkerBuildIdCompatibilityResponse) {}
|
|
393
|
+
// Fetches the worker build id versioning sets for some task queue and related metadata.
|
|
394
|
+
rpc GetWorkerBuildIdCompatibility (GetWorkerBuildIdCompatibilityRequest) returns (GetWorkerBuildIdCompatibilityResponse) {}
|
|
393
395
|
|
|
394
396
|
// Invokes the specified update function on user workflow code.
|
|
395
397
|
// (-- api-linter: core::0134=disabled
|
|
@@ -397,6 +399,15 @@ service WorkflowService {
|
|
|
397
399
|
rpc UpdateWorkflowExecution(UpdateWorkflowExecutionRequest) returns (UpdateWorkflowExecutionResponse) {
|
|
398
400
|
}
|
|
399
401
|
|
|
402
|
+
// Polls a workflow execution for the outcome of a workflow execution update
|
|
403
|
+
// previously issued through the UpdateWorkflowExecution RPC. The effective
|
|
404
|
+
// timeout on this call will be shorter of the the caller-supplied gRPC
|
|
405
|
+
// timeout and the server's configured long-poll timeout.
|
|
406
|
+
// (-- api-linter: core::0134=disabled
|
|
407
|
+
// aip.dev/not-precedent: UpdateWorkflowExecution doesn't follow Google API format --)
|
|
408
|
+
rpc PollWorkflowExecutionUpdate(PollWorkflowExecutionUpdateRequest) returns (PollWorkflowExecutionUpdateResponse){
|
|
409
|
+
}
|
|
410
|
+
|
|
400
411
|
// StartBatchOperation starts a new batch operation
|
|
401
412
|
rpc StartBatchOperation(StartBatchOperationRequest) returns (StartBatchOperationResponse) {
|
|
402
413
|
}
|
|
@@ -22,7 +22,8 @@ use std::{
|
|
|
22
22
|
time::Duration,
|
|
23
23
|
};
|
|
24
24
|
use temporal_client::{
|
|
25
|
-
Client, RetryClient, WorkflowClientTrait, WorkflowExecutionInfo,
|
|
25
|
+
Client, ClientTlsConfig, RetryClient, TlsConfig, WorkflowClientTrait, WorkflowExecutionInfo,
|
|
26
|
+
WorkflowOptions,
|
|
26
27
|
};
|
|
27
28
|
use temporal_sdk::{
|
|
28
29
|
interceptors::{FailOnNondeterminismInterceptor, WorkerInterceptor},
|
|
@@ -34,8 +35,8 @@ use temporal_sdk_core::{
|
|
|
34
35
|
replay::HistoryForReplay,
|
|
35
36
|
ClientOptions, ClientOptionsBuilder, CoreRuntime, WorkerConfig, WorkerConfigBuilder,
|
|
36
37
|
};
|
|
37
|
-
use temporal_sdk_core_api::errors::{PollActivityError, PollWfError};
|
|
38
38
|
use temporal_sdk_core_api::{
|
|
39
|
+
errors::{PollActivityError, PollWfError},
|
|
39
40
|
telemetry::{
|
|
40
41
|
Logger, MetricsExporter, OtelCollectorOptions, TelemetryOptions, TelemetryOptionsBuilder,
|
|
41
42
|
TraceExportConfig, TraceExporter,
|
|
@@ -60,6 +61,7 @@ pub const NAMESPACE: &str = "default";
|
|
|
60
61
|
pub const TEST_Q: &str = "q";
|
|
61
62
|
/// The env var used to specify where the integ tests should point
|
|
62
63
|
pub const INTEG_SERVER_TARGET_ENV_VAR: &str = "TEMPORAL_SERVICE_ADDRESS";
|
|
64
|
+
pub const INTEG_USE_TLS_ENV_VAR: &str = "TEMPORAL_USE_TLS";
|
|
63
65
|
/// This env var is set (to any value) if temporal CLI dev server is in use
|
|
64
66
|
pub const INTEG_TEMPORAL_DEV_SERVER_USED_ENV_VAR: &str = "INTEG_TEMPORAL_DEV_SERVER_ON";
|
|
65
67
|
/// This env var is set (to any value) if the test server is in use
|
|
@@ -533,13 +535,33 @@ pub fn get_integ_server_options() -> ClientOptions {
|
|
|
533
535
|
Err(_) => "http://localhost:7233".to_owned(),
|
|
534
536
|
};
|
|
535
537
|
let url = Url::try_from(&*temporal_server_address).unwrap();
|
|
536
|
-
ClientOptionsBuilder::default()
|
|
537
|
-
|
|
538
|
+
let mut cb = ClientOptionsBuilder::default();
|
|
539
|
+
cb.identity("integ_tester".to_string())
|
|
538
540
|
.target_url(url)
|
|
539
541
|
.client_name("temporal-core".to_string())
|
|
540
|
-
.client_version("0.1.0".to_string())
|
|
541
|
-
|
|
542
|
-
.
|
|
542
|
+
.client_version("0.1.0".to_string());
|
|
543
|
+
if let Some(tls) = get_integ_tls_config() {
|
|
544
|
+
cb.tls_cfg(tls);
|
|
545
|
+
};
|
|
546
|
+
cb.build().unwrap()
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
pub fn get_integ_tls_config() -> Option<TlsConfig> {
|
|
550
|
+
if env::var(INTEG_USE_TLS_ENV_VAR).is_ok() {
|
|
551
|
+
let root = std::fs::read("../.cloud_certs/ca.pem").unwrap();
|
|
552
|
+
let client_cert = std::fs::read("../.cloud_certs/client.pem").unwrap();
|
|
553
|
+
let client_private_key = std::fs::read("../.cloud_certs/client.key").unwrap();
|
|
554
|
+
Some(TlsConfig {
|
|
555
|
+
server_root_ca_cert: Some(root),
|
|
556
|
+
domain: None,
|
|
557
|
+
client_tls_config: Some(ClientTlsConfig {
|
|
558
|
+
client_cert,
|
|
559
|
+
client_private_key,
|
|
560
|
+
}),
|
|
561
|
+
})
|
|
562
|
+
} else {
|
|
563
|
+
None
|
|
564
|
+
}
|
|
543
565
|
}
|
|
544
566
|
|
|
545
567
|
pub fn get_integ_telem_options() -> TelemetryOptions {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
use crate::integ_tests::activity_functions::echo;
|
|
1
2
|
use anyhow::anyhow;
|
|
2
3
|
use assert_matches::assert_matches;
|
|
3
4
|
use futures_util::future::join_all;
|
|
@@ -52,10 +53,7 @@ async fn one_activity() {
|
|
|
52
53
|
let mut worker = starter.worker().await;
|
|
53
54
|
let client = starter.get_client().await;
|
|
54
55
|
worker.register_wf(wf_name.to_owned(), one_activity_wf);
|
|
55
|
-
worker.register_activity(
|
|
56
|
-
"echo_activity",
|
|
57
|
-
|_ctx: ActContext, echo_me: String| async move { Ok(echo_me) },
|
|
58
|
-
);
|
|
56
|
+
worker.register_activity("echo_activity", echo);
|
|
59
57
|
|
|
60
58
|
let run_id = worker
|
|
61
59
|
.submit_wf(
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
use crate::integ_tests::activity_functions::echo;
|
|
1
2
|
use anyhow::anyhow;
|
|
2
3
|
use futures::future::join_all;
|
|
3
4
|
use std::{
|
|
@@ -12,9 +13,10 @@ use temporal_sdk::{
|
|
|
12
13
|
use temporal_sdk_core::replay::HistoryForReplay;
|
|
13
14
|
use temporal_sdk_core_protos::{
|
|
14
15
|
coresdk::{
|
|
15
|
-
workflow_commands::workflow_command::Variant,
|
|
16
|
-
workflow_completion,
|
|
17
|
-
workflow_completion::
|
|
16
|
+
workflow_commands::{workflow_command::Variant, ActivityCancellationType},
|
|
17
|
+
workflow_completion,
|
|
18
|
+
workflow_completion::{workflow_activation_completion, WorkflowActivationCompletion},
|
|
19
|
+
AsJsonPayloadExt,
|
|
18
20
|
},
|
|
19
21
|
temporal::api::{common::v1::RetryPolicy, enums::v1::TimeoutType},
|
|
20
22
|
TestHistoryBuilder,
|
|
@@ -25,10 +27,6 @@ use temporal_sdk_core_test_utils::{
|
|
|
25
27
|
};
|
|
26
28
|
use tokio_util::sync::CancellationToken;
|
|
27
29
|
|
|
28
|
-
pub async fn echo(_ctx: ActContext, e: String) -> anyhow::Result<String> {
|
|
29
|
-
Ok(e)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
30
|
pub async fn one_local_activity_wf(ctx: WfContext) -> WorkflowResult<()> {
|
|
33
31
|
let initial_workflow_time = ctx.workflow_time().expect("Workflow time should be set");
|
|
34
32
|
ctx.local_activity(LocalActivityOptions {
|
|
@@ -15,6 +15,7 @@ mod stickyness;
|
|
|
15
15
|
mod timers;
|
|
16
16
|
mod upsert_search_attrs;
|
|
17
17
|
|
|
18
|
+
use crate::integ_tests::activity_functions::echo;
|
|
18
19
|
use assert_matches::assert_matches;
|
|
19
20
|
use futures::{channel::mpsc::UnboundedReceiver, future, SinkExt, StreamExt};
|
|
20
21
|
use std::{
|
|
@@ -26,9 +27,7 @@ use std::{
|
|
|
26
27
|
time::Duration,
|
|
27
28
|
};
|
|
28
29
|
use temporal_client::{WorkflowClientTrait, WorkflowOptions};
|
|
29
|
-
use temporal_sdk::{
|
|
30
|
-
interceptors::WorkerInterceptor, ActContext, ActivityOptions, WfContext, WorkflowResult,
|
|
31
|
-
};
|
|
30
|
+
use temporal_sdk::{interceptors::WorkerInterceptor, ActivityOptions, WfContext, WorkflowResult};
|
|
32
31
|
use temporal_sdk_core::replay::HistoryForReplay;
|
|
33
32
|
use temporal_sdk_core_api::{errors::PollWfError, Worker};
|
|
34
33
|
use temporal_sdk_core_protos::{
|
|
@@ -564,10 +563,7 @@ async fn slow_completes_with_small_cache() {
|
|
|
564
563
|
}
|
|
565
564
|
Ok(().into())
|
|
566
565
|
});
|
|
567
|
-
worker.register_activity(
|
|
568
|
-
"echo_activity",
|
|
569
|
-
|_ctx: ActContext, echo_me: String| async move { Ok(echo_me) },
|
|
570
|
-
);
|
|
566
|
+
worker.register_activity("echo_activity", echo);
|
|
571
567
|
for i in 0..20 {
|
|
572
568
|
worker
|
|
573
569
|
.submit_wf(
|
package/sdk-core/tests/main.rs
CHANGED
|
@@ -7,6 +7,7 @@ extern crate temporal_sdk_core_test_utils;
|
|
|
7
7
|
|
|
8
8
|
#[cfg(test)]
|
|
9
9
|
mod integ_tests {
|
|
10
|
+
mod activity_functions;
|
|
10
11
|
mod client_tests;
|
|
11
12
|
mod ephemeral_server_tests;
|
|
12
13
|
mod heartbeat_tests;
|
|
@@ -25,7 +26,7 @@ mod integ_tests {
|
|
|
25
26
|
use temporal_sdk_core_api::worker::WorkerConfigBuilder;
|
|
26
27
|
use temporal_sdk_core_protos::temporal::api::workflowservice::v1::ListNamespacesRequest;
|
|
27
28
|
use temporal_sdk_core_test_utils::{
|
|
28
|
-
get_integ_server_options, get_integ_telem_options,
|
|
29
|
+
get_integ_server_options, get_integ_telem_options, init_integ_telem,
|
|
29
30
|
};
|
|
30
31
|
use url::Url;
|
|
31
32
|
|
|
@@ -58,35 +59,23 @@ mod integ_tests {
|
|
|
58
59
|
.await;
|
|
59
60
|
}
|
|
60
61
|
|
|
61
|
-
//
|
|
62
|
-
//
|
|
63
|
-
// https://github.com/temporalio/customization-samples/tree/master/tls/tls-simple
|
|
62
|
+
// Manually run to verify tls works against cloud. You will need certs in place in the
|
|
63
|
+
// indicated directory.
|
|
64
64
|
#[tokio::test]
|
|
65
65
|
#[ignore]
|
|
66
66
|
async fn tls_test() {
|
|
67
|
-
|
|
68
|
-
let root = tokio::fs::read(
|
|
69
|
-
|
|
70
|
-
)
|
|
71
|
-
.await
|
|
72
|
-
.unwrap();
|
|
73
|
-
let client_cert = tokio::fs::read(
|
|
74
|
-
"/home/sushi/dev/temporal/customization-samples/tls/tls-simple/certs/client.pem",
|
|
75
|
-
)
|
|
76
|
-
.await
|
|
77
|
-
.unwrap();
|
|
78
|
-
let client_private_key = tokio::fs::read(
|
|
79
|
-
"/home/sushi/dev/temporal/customization-samples/tls/tls-simple/certs/client.key",
|
|
80
|
-
)
|
|
81
|
-
.await
|
|
82
|
-
.unwrap();
|
|
67
|
+
init_integ_telem();
|
|
68
|
+
let root = tokio::fs::read("../.cloud_certs/ca.pem").await.unwrap();
|
|
69
|
+
let client_cert = tokio::fs::read("../.cloud_certs/client.pem").await.unwrap();
|
|
70
|
+
let client_private_key = tokio::fs::read("../.cloud_certs/client.key").await.unwrap();
|
|
83
71
|
let sgo = ClientOptionsBuilder::default()
|
|
84
|
-
.target_url(Url::from_str("https://
|
|
72
|
+
.target_url(Url::from_str("https://spencer.temporal-dev.tmprl.cloud:7233").unwrap())
|
|
85
73
|
.client_name("tls_tester")
|
|
86
74
|
.client_version("clientver")
|
|
87
75
|
.tls_cfg(TlsConfig {
|
|
88
76
|
server_root_ca_cert: Some(root),
|
|
89
|
-
|
|
77
|
+
// Not necessary, but illustrates functionality for people using proxies, etc.
|
|
78
|
+
domain: Some("spencer.temporal-dev.tmprl.cloud".to_string()),
|
|
90
79
|
client_tls_config: Some(ClientTlsConfig {
|
|
91
80
|
client_cert,
|
|
92
81
|
client_private_key,
|
|
@@ -95,9 +84,12 @@ mod integ_tests {
|
|
|
95
84
|
.build()
|
|
96
85
|
.unwrap();
|
|
97
86
|
let con = sgo
|
|
98
|
-
.connect(
|
|
87
|
+
.connect("spencer.temporal-dev".to_string(), None, None)
|
|
99
88
|
.await
|
|
100
89
|
.unwrap();
|
|
101
|
-
con
|
|
90
|
+
dbg!(con
|
|
91
|
+
.list_workflow_executions(100, vec![], "".to_string())
|
|
92
|
+
.await
|
|
93
|
+
.unwrap());
|
|
102
94
|
}
|
|
103
95
|
}
|