-
Notifications
You must be signed in to change notification settings - Fork 30
Fix auto_time_skipping_disabled #260
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -55,6 +55,34 @@ def test_time_skipping_auto | |
| end | ||
| end | ||
|
|
||
| def test_auto_time_skipping_disabled | ||
| skip_if_not_x86! | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know if this line is required -- seemed to run fine on my apple silicon Mac 🤷 but left it for consistency
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks! Yeah it runs in macos due to rosetta x64 translator, but technically we don't support time-skipping on ARM (though it was added recently, we just have to update the auto downloader). |
||
| Temporalio::Testing::WorkflowEnvironment.start_time_skipping(logger: Logger.new($stdout)) do |env| | ||
| worker = Temporalio::Worker.new( | ||
| client: env.client, | ||
| task_queue: "tq-#{SecureRandom.uuid}", | ||
| workflows: [SlowWorkflow] | ||
| ) | ||
| worker.run do | ||
| # Check that timestamp is around now | ||
| assert_in_delta(Time.now, env.current_time, 30.0) | ||
|
|
||
| # Run workflow | ||
| handle = env.client.start_workflow( | ||
| SlowWorkflow, | ||
| id: "wf-#{SecureRandom.uuid}", | ||
| task_queue: worker.task_queue | ||
| ) | ||
| env.auto_time_skipping_disabled do | ||
| handle.signal(SlowWorkflow.some_signal) | ||
| end | ||
| # Check that timestamp is now about two days from now | ||
| assert_equal 'all done', handle.result | ||
| assert_in_delta Time.now + SlowWorkflow::TWO_DAYS, env.current_time, 30.0 | ||
| end | ||
| end | ||
| end | ||
|
|
||
| def test_time_skipping_manual | ||
| skip_if_not_x86! | ||
| Temporalio::Testing::WorkflowEnvironment.start_time_skipping(logger: Logger.new($stdout)) do |env| | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I think our logic at https://github.com/temporalio/sdk-dotnet/blob/d48377d698b2a2cb7a8c58d181959df473875314/src/Temporalio/Testing/WorkflowEnvironment.cs#L323-L338 is wrong (and https://github.com/temporalio/sdk-python/blob/e3603989f081bb812d883189be5f5ac9aa127089/temporalio/testing/_workflow.py#L464-L472 is right), so time to fix .NET too heh.