-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adds test example for hello_update.py (#118)
- Loading branch information
1 parent
ba5fd0f
commit 276aaf7
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import uuid | ||
|
||
import pytest | ||
from temporalio.client import Client, WorkflowExecutionStatus | ||
from temporalio.testing import WorkflowEnvironment | ||
from temporalio.worker import Worker | ||
|
||
from hello.hello_update import GreetingWorkflow | ||
|
||
|
||
async def test_update_workflow(client: Client, env: WorkflowEnvironment): | ||
if env.supports_time_skipping: | ||
pytest.skip( | ||
"Time-skipping test server currently has issue with update: https://github.com/temporalio/sdk-java/issues/1903" | ||
) | ||
task_queue_name = str(uuid.uuid4()) | ||
async with Worker(client, task_queue=task_queue_name, workflows=[GreetingWorkflow]): | ||
handle = await client.start_workflow( | ||
GreetingWorkflow.run, id=str(uuid.uuid4()), task_queue=task_queue_name | ||
) | ||
|
||
assert WorkflowExecutionStatus.RUNNING == (await handle.describe()).status | ||
|
||
update_result = await handle.execute_update( | ||
GreetingWorkflow.update_workflow_status | ||
) | ||
assert "Workflow status updated" == update_result | ||
assert "Hello, World!" == (await handle.result()) | ||
assert WorkflowExecutionStatus.COMPLETED == (await handle.describe()).status |