11import asyncio
2+ import logging
23import uuid
34from datetime import datetime , timedelta , timezone
45from time import monotonic
1819from temporalio .testing import WorkflowEnvironment
1920from tests .worker .test_workflow import new_worker
2021
22+ logger = logging .getLogger (__name__ )
23+
2124
2225@workflow .defn
2326class ReallySlowWorkflow :
@@ -36,29 +39,45 @@ async def some_signal(self) -> None:
3639
3740
3841async def test_workflow_env_time_skipping_basic ():
39- async with await WorkflowEnvironment .start_time_skipping () as env :
40- async with new_worker (env .client , ReallySlowWorkflow ) as worker :
41- # Check that time is around now
42- assert_timestamp_from_now (await env .get_current_time (), 0 )
43- # Run workflow
44- assert "all done" == await env .client .execute_workflow (
45- ReallySlowWorkflow .run ,
46- id = f"workflow-{ uuid .uuid4 ()} " ,
47- task_queue = worker .task_queue ,
48- )
49- # Check that the time is around 100000 seconds after now
50- assert_timestamp_from_now (await env .get_current_time (), 100000 )
42+ print ("CI LOGA1" )
43+ try :
44+ async with await WorkflowEnvironment .start_time_skipping () as env :
45+ print ("CI LOGA2" )
46+ async with new_worker (env .client , ReallySlowWorkflow ) as worker :
47+ print ("CI LOGA3" )
48+ # Check that time is around now
49+ assert_timestamp_from_now (await env .get_current_time (), 0 )
50+ # Run workflow
51+ print ("CI LOGA4" )
52+ assert "all done" == await env .client .execute_workflow (
53+ ReallySlowWorkflow .run ,
54+ id = f"workflow-{ uuid .uuid4 ()} " ,
55+ task_queue = worker .task_queue ,
56+ )
57+ print ("CI LOGA5" , datetime .now ())
58+ # Check that the time is around 100000 seconds after now
59+ assert_timestamp_from_now (await env .get_current_time (), 100000 )
60+ print ("CI LOGA6" , datetime .now ())
61+ print ("CI LOGA7" , datetime .now ())
62+ print ("CI LOGA8" , datetime .now ())
63+ except :
64+ logger .exception ("OH NO" )
65+ raise
5166
5267
5368async def test_workflow_env_time_skipping_manual ():
69+ print ("CI LOGB1" , datetime .now ())
5470 async with await WorkflowEnvironment .start_time_skipping () as env :
71+ print ("CI LOGB2" , datetime .now ())
5572 async with new_worker (env .client , ReallySlowWorkflow ) as worker :
73+ print ("CI LOGB3" , datetime .now ())
5674 # Start workflow
5775 handle = await env .client .start_workflow (
5876 ReallySlowWorkflow .run ,
5977 id = f"workflow-{ uuid .uuid4 ()} " ,
6078 task_queue = worker .task_queue ,
6179 )
80+ print ("CI LOGB4" )
6281
6382 async def workflow_current_time () -> float :
6483 # We send signal first since query timestamp is based on last
@@ -67,11 +86,17 @@ async def workflow_current_time() -> float:
6786 return await handle .query (ReallySlowWorkflow .current_time )
6887
6988 # Confirm query will say we're near current time
89+ print ("CI LOGB5" )
7090 assert_timestamp_from_now (await workflow_current_time (), 0 )
7191
7292 # Sleep and confirm query will say we're near that time
93+ print ("CI LOGB6" )
7394 await env .sleep (1000 )
95+ print ("CI LOGB7" )
7496 assert_timestamp_from_now (await workflow_current_time (), 1000 )
97+ print ("CI LOGB8" )
98+ print ("CI LOGB9" )
99+ print ("CI LOGB10" )
75100
76101
77102class Activities :
0 commit comments