Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: workflow update tests #474

Closed
wants to merge 3 commits into from

Conversation

roxblnfk
Copy link

@roxblnfk roxblnfk commented Feb 21, 2024

Reason for This PR

Need to test Workflow Update functionality

Description of Changes

  • Tests for the Updates logic.
  • The workflow name used in the tests is Update.greet.

Tests:

  1. Run Update.greet workflow -> empty list on exit.
  2. Run Update.greet workflow with addNameWithoutValidation method. Args: John Doe 42 -> should return Hello, John Doe 42!.
  3. Run Update.greet workflow with addName method. Args: John Doe -> should return Hello, John Doe!.
  4. Run Update.greet workflow with addName method. Args: 123 -> should failure with the message: Name must not contain digits.
  5. Run Update.greet workflow with throwException method. Args: John Doe -> should failure with the following message: Test exception with John Doe.
  6. Run Update.greet workflow with randomizeName method. Args: 1 (int) -> should execute a SideEffect and return a slice with the random string.
  7. The same as 6, but with Args: 3 (int) -> should execute a SideEffect and return 3 random strings in a slice.
  8. Run Update.greet workflow with addNameViaActivity method. Args: John Doe -> should execute an Activity and return lowercased name: Hello, john doe!.
  9. Run AwaitsUpdate.greet; update awaitWithTimeout 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) (send exit signal to complete Workflow)
  10. Run AwaitsUpdate.greet; start async update await with arg "key" -> will wait for resolving; query getValue with arg "key" should return null; update resolveValue with args "key", "resolved" -> should resolve await in the previous await update and return "resolved"; query getValue with arg "key" should return "resolved"; workflow should return {"key": "resolved"} (send exit signal to complete Workflow)
  11. The same as 10, but with 5 await Updates and then 5 resolve Updates (use unique keys in args) -> should open and complete 5 parallel updates.
  12. Run AwaitsUpdate.greet; for $i from 1 to 3, start async update awaitWithTimeout with args "key$i", 5, "fallback$i"; for $i from 1 to 3, start async update resolveValue with args "key$i", "resolved$i" -> awaits will be resolved before timeout; workflow should return {"key1": "fallback1", "key2": "fallback2", "key3": "fallback3",} (send exit signal to complete Workflow)

Note

Tests from 9 should be executed with WaitPolicy=StageAccepted, and Temporal server option frontend.enableUpdateWorkflowExecutionAsyncAccepted=true

Warning

All the tests require Temporal option frontend.enableUpdateWorkflowExecution=true

Warning

Need to discard changes in composer.json before merging into master branch

License 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]

  • All commits in this PR are signed (git commit -s).
  • The reason for this PR is clearly provided (issue no. or explanation).
  • The description of changes is clear and encompassing.
  • Any required documentation changes (code and docs) are included in this PR.
  • Any user-facing changes are mentioned in CHANGELOG.md.
  • All added/changed functionality is tested.

@rustatian rustatian changed the title Add Workflow Update tests chore: workflow update tests Feb 21, 2024
@rustatian rustatian self-requested a review February 21, 2024 23:27
@rustatian rustatian self-assigned this Feb 21, 2024
@rustatian rustatian added A-CI Area: CI CD A-tests Area: test (update, create, etc...) C-enhancement Category: enhancement. Meaning improvements of current module, transport, etc.. labels Feb 21, 2024
@rustatian rustatian closed this Feb 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-CI Area: CI CD A-tests Area: test (update, create, etc...) C-enhancement Category: enhancement. Meaning improvements of current module, transport, etc..
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants