@@ -41,12 +41,13 @@ def mobile_context(mobile_rw_context):
41
41
def _craft_context (rw_context ):
42
42
rw_context .config ["reclaim_interval" ] = 0.001
43
43
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" )
45
46
rw_context .claim_task = {
46
47
"credentials" : {"a" : "b" },
47
48
"status" : {"taskId" : "taskId" },
48
49
"task" : {"dependencies" : ["dependency1" , "dependency2" ], "taskGroupId" : "dependency0" },
49
- "runId" : "runId" ,
50
+ "runId" : 0 ,
50
51
}
51
52
return rw_context
52
53
@@ -482,7 +483,7 @@ def test_is_action(task, expected):
482
483
def test_prepare_to_run_task (context ):
483
484
claim_task = context .claim_task
484
485
context .claim_task = None
485
- expected = {"taskId" : "taskId" , "runId" : "runId" }
486
+ expected = {"taskId" : "taskId" , "runId" : 0 }
486
487
path = os .path .join (context .config ["work_dir" ], "current_task_info.json" )
487
488
assert swtask .prepare_to_run_task (context , claim_task ) == expected
488
489
assert os .path .exists (path )
@@ -496,7 +497,7 @@ def test_prepare_to_run_task(context):
496
497
async def test_run_task (context ):
497
498
status = await swtask .run_task (context , noop_to_cancellable_process )
498
499
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 " )
500
501
assert status == 1
501
502
502
503
@@ -570,29 +571,29 @@ async def test_run_task_timeout(context):
570
571
async def test_reportCompleted (context , successful_queue ):
571
572
context .temp_queue = successful_queue
572
573
await swtask .complete_task (context , 0 )
573
- assert successful_queue .info == ["reportCompleted" , ("taskId" , "runId" ), {}]
574
+ assert successful_queue .info == ["reportCompleted" , ("taskId" , 0 ), {}]
574
575
575
576
576
577
@pytest .mark .asyncio
577
578
async def test_reportFailed (context , successful_queue ):
578
579
context .temp_queue = successful_queue
579
580
await swtask .complete_task (context , 1 )
580
- assert successful_queue .info == ["reportFailed" , ("taskId" , "runId" ), {}]
581
+ assert successful_queue .info == ["reportFailed" , ("taskId" , 0 ), {}]
581
582
582
583
583
584
@pytest .mark .asyncio
584
585
async def test_reportException (context , successful_queue ):
585
586
context .temp_queue = successful_queue
586
587
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" }), {}]
588
589
589
590
590
591
@pytest .mark .parametrize ("exit_code" , (245 , 241 ))
591
592
@pytest .mark .asyncio
592
593
async def test_reversed_statuses (context , successful_queue , exit_code ):
593
594
context .temp_queue = successful_queue
594
595
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 ]}), {}]
596
597
597
598
598
599
# complete_task {{{1
0 commit comments