@@ -41,12 +41,13 @@ def mobile_context(mobile_rw_context):
4141def _craft_context (rw_context ):
4242 rw_context .config ["reclaim_interval" ] = 0.001
4343 rw_context .config ["task_max_timeout" ] = 1
44- rw_context .config ["task_script" ] = ("bash" , "-c" , ">&2 echo bar && echo foo && exit 1" )
44+ rw_context .config ["taskcluster_root_url" ] = "https://tc"
45+ rw_context .config ["task_script" ] = ("bash" , "-c" , ">&2 echo $TASK_ID && echo $RUN_ID && echo $TASKCLUSTER_ROOT_URL && exit 1" )
4546 rw_context .claim_task = {
4647 "credentials" : {"a" : "b" },
4748 "status" : {"taskId" : "taskId" },
4849 "task" : {"dependencies" : ["dependency1" , "dependency2" ], "taskGroupId" : "dependency0" },
49- "runId" : "runId" ,
50+ "runId" : 0 ,
5051 }
5152 return rw_context
5253
@@ -482,7 +483,7 @@ def test_is_action(task, expected):
482483def test_prepare_to_run_task (context ):
483484 claim_task = context .claim_task
484485 context .claim_task = None
485- expected = {"taskId" : "taskId" , "runId" : "runId" }
486+ expected = {"taskId" : "taskId" , "runId" : 0 }
486487 path = os .path .join (context .config ["work_dir" ], "current_task_info.json" )
487488 assert swtask .prepare_to_run_task (context , claim_task ) == expected
488489 assert os .path .exists (path )
@@ -496,7 +497,7 @@ def test_prepare_to_run_task(context):
496497async def test_run_task (context ):
497498 status = await swtask .run_task (context , noop_to_cancellable_process )
498499 log_file = log .get_log_filename (context )
499- assert read (log_file ) in ("bar \n foo \ n exit code: 1\n " , "foo \n bar \n exit code: 1\n " )
500+ assert read (log_file ) in ("taskId \n 0 \n https://tc \ n exit code: 1\n " , "taskId \n 0 \n https://tc \n exit code: 1\n " )
500501 assert status == 1
501502
502503
@@ -570,29 +571,29 @@ async def test_run_task_timeout(context):
570571async def test_reportCompleted (context , successful_queue ):
571572 context .temp_queue = successful_queue
572573 await swtask .complete_task (context , 0 )
573- assert successful_queue .info == ["reportCompleted" , ("taskId" , "runId" ), {}]
574+ assert successful_queue .info == ["reportCompleted" , ("taskId" , 0 ), {}]
574575
575576
576577@pytest .mark .asyncio
577578async def test_reportFailed (context , successful_queue ):
578579 context .temp_queue = successful_queue
579580 await swtask .complete_task (context , 1 )
580- assert successful_queue .info == ["reportFailed" , ("taskId" , "runId" ), {}]
581+ assert successful_queue .info == ["reportFailed" , ("taskId" , 0 ), {}]
581582
582583
583584@pytest .mark .asyncio
584585async def test_reportException (context , successful_queue ):
585586 context .temp_queue = successful_queue
586587 await swtask .complete_task (context , 2 )
587- assert successful_queue .info == ["reportException" , ("taskId" , "runId" , {"reason" : "worker-shutdown" }), {}]
588+ assert successful_queue .info == ["reportException" , ("taskId" , 0 , {"reason" : "worker-shutdown" }), {}]
588589
589590
590591@pytest .mark .parametrize ("exit_code" , (245 , 241 ))
591592@pytest .mark .asyncio
592593async def test_reversed_statuses (context , successful_queue , exit_code ):
593594 context .temp_queue = successful_queue
594595 await swtask .complete_task (context , exit_code )
595- assert successful_queue .info == ["reportException" , ("taskId" , "runId" , {"reason" : context .config ["reversed_statuses" ][exit_code ]}), {}]
596+ assert successful_queue .info == ["reportException" , ("taskId" , 0 , {"reason" : context .config ["reversed_statuses" ][exit_code ]}), {}]
596597
597598
598599# complete_task {{{1
0 commit comments