File tree 1 file changed +26
-0
lines changed
1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change
1
+ import uuid
2
+
3
+ from temporalio .testing import WorkflowEnvironment
4
+ from temporalio .worker import Worker
5
+
6
+ from hello .hello_query import GreetingWorkflow
7
+
8
+
9
+ async def test_query_workflow ():
10
+ task_queue_name = str (uuid .uuid4 ())
11
+ # start manual time skipping
12
+ async with await WorkflowEnvironment .start_time_skipping () as env :
13
+ async with Worker (
14
+ env .client , task_queue = task_queue_name , workflows = [GreetingWorkflow ]
15
+ ):
16
+ handle = await env .client .start_workflow (
17
+ GreetingWorkflow .run ,
18
+ "World" ,
19
+ id = str (uuid .uuid4 ()),
20
+ task_queue = task_queue_name ,
21
+ )
22
+
23
+ assert "Hello, World!" == await handle .query (GreetingWorkflow .greeting )
24
+ # manually skip 3 seconds. This will allow the workflow execution to move forward
25
+ await env .sleep (3 )
26
+ assert "Goodbye, World!" == await handle .query (GreetingWorkflow .greeting )
You can’t perform that action at this time.
0 commit comments