@@ -190,6 +190,27 @@ def mock_client(service):
190190 mock_index .findTask .assert_called_with (index )
191191
192192
193+ def test_find_task_id_batched (monkeypatch , responses , root_url ):
194+ monkeypatch .setattr (os , "environ" , {"TASKCLUSTER_ROOT_URL" : root_url })
195+ responses .post (
196+ f"{ root_url } /api/index/v1/tasks/indexes" ,
197+ json = {
198+ "tasks" : [{"taskId" : "abc" , "namespace" : "index.abc" }],
199+ "continuationToken" : "abc" ,
200+ },
201+ )
202+ responses .post (
203+ f"{ root_url } /api/index/v1/tasks/indexes" ,
204+ json = {
205+ "tasks" : [{"taskId" : "def" , "namespace" : "index.def" }],
206+ "continuationToken" : None ,
207+ },
208+ )
209+
210+ result = tc .find_task_id_batched (["index.abc" , "index.def" ])
211+ assert result == {"index.abc" : "abc" , "index.def" : "def" }
212+
213+
193214def test_get_artifact_from_index (monkeypatch ):
194215 index = "foo"
195216 path = "file.txt"
@@ -298,6 +319,40 @@ def mock_client(service):
298319 mock_queue .status .assert_called_with (tid )
299320
300321
322+ def test_status_task_batched (monkeypatch , responses , root_url ):
323+ monkeypatch .setattr (os , "environ" , {"TASKCLUSTER_ROOT_URL" : root_url })
324+ responses .post (
325+ f"{ root_url } /api/queue/v1/tasks/status" ,
326+ json = {
327+ "statuses" : [
328+ {
329+ "taskId" : "abc" ,
330+ "status" : {"taskId" : "abc" , "state" : "completed" , "runs" : []},
331+ }
332+ ],
333+ "continuationToken" : "abc" ,
334+ },
335+ )
336+ responses .post (
337+ f"{ root_url } /api/queue/v1/tasks/status" ,
338+ json = {
339+ "statuses" : [
340+ {
341+ "taskId" : "def" ,
342+ "status" : {"taskId" : "def" , "state" : "exception" , "runs" : []},
343+ }
344+ ],
345+ "continuationToken" : None ,
346+ },
347+ )
348+
349+ result = tc .status_task_batched (["abc" , "def" ])
350+ assert result == {
351+ "abc" : {"taskId" : "abc" , "state" : "completed" , "runs" : []},
352+ "def" : {"taskId" : "def" , "state" : "exception" , "runs" : []},
353+ }
354+
355+
301356def test_state_task (monkeypatch ):
302357 tid = "123"
303358
0 commit comments