Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Reason for This PR
Need to test Workflow Update functionality
Description of Changes
Update.greet
.Tests:
Update.greet
workflow -> empty list on exit.Update.greet
workflow withaddNameWithoutValidation
method. Args:John Doe 42
->
should returnHello, John Doe 42!
.Update.greet
workflow withaddName
method. Args:John Doe
->
should returnHello, John Doe!
.Update.greet
workflow withaddName
method. Args:123
->
should failure with the message:Name must not contain digits
.Update.greet
workflow withthrowException
method. Args:John Doe
-> should failure with the following message:Test exception with John Doe
.Update.greet
workflow withrandomizeName
method. Args:1
(int) -> should execute a SideEffect and return a slice with the random string.3
(int)->
should execute a SideEffect and return 3 random strings in a slice.Update.greet
workflow withaddNameViaActivity
method. Args:John Doe
->
should execute an Activity and return lowercased name:Hello, john doe!
.AwaitsUpdate.greet
; updateawaitWithTimeout
with args"key"
,1
,"fallback"
-> the Update should sleep for 1 second and return"fallback"
; workflow should return{"key": "fallback"}
(associative array ->map[string]any
) (sendexit
signal to complete Workflow)AwaitsUpdate.greet
; start async updateawait
with arg"key"
-> will wait for resolving; querygetValue
with arg"key"
should returnnull
; updateresolveValue
with args"key"
,"resolved"
-> should resolve await in the previousawait
update and return"resolved"
; querygetValue
with arg"key"
should return"resolved"
; workflow should return{"key": "resolved"}
(sendexit
signal to complete Workflow)await
Updates and then 5resolve
Updates (use unique keys in args)->
should open and complete 5 parallel updates.AwaitsUpdate.greet
; for $i from 1 to 3, start async updateawaitWithTimeout
with args"key$i"
,5
,"fallback$i"
; for $i from 1 to 3, start async updateresolveValue
with args"key$i"
,"resolved$i"
-> awaits will be resolved before timeout; workflow should return{"key1": "fallback1", "key2": "fallback2", "key3": "fallback3",}
(sendexit
signal to complete Workflow)Note
Tests from 9 should be executed with
WaitPolicy=StageAccepted
, and Temporal server optionfrontend.enableUpdateWorkflowExecutionAsyncAccepted=true
Warning
All the tests require Temporal option
frontend.enableUpdateWorkflowExecution=true
Warning
Need to discard changes in
composer.json
before merging intomaster
branchLicense Acceptance
By submitting this pull request, I confirm that my contribution is made under
the terms of the MIT license.
PR Checklist
[Author TODO: Meet these criteria.]
[Reviewer TODO: Verify that these criteria are met. Request changes if not]
git commit -s
).CHANGELOG.md
.