Skip to content

Commit

Permalink
adds test example for hello_update.py (#118)
Browse files Browse the repository at this point in the history
  • Loading branch information
yashvanzara authored Jul 22, 2024
1 parent ba5fd0f commit 276aaf7
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/hello/hello_update_test.py
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

0 comments on commit 276aaf7

Please sign in to comment.