Bug 1604749: [taskgraph] Fix tests for index morph; r=Callek

Differential Revision: https://phabricator.services.mozilla.com/D58412

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Tom Prince 2019-12-31 04:26:11 +00:00
Родитель 7fec362cac
Коммит bff49201f2
2 изменённых файлов: 16 добавлений и 5 удалений

Просмотреть файл

@ -120,7 +120,7 @@ def make_index_task(parent_task, taskgraph, label_to_taskid, parameters, graph_c
if not r.startswith('index.')]
task = derive_misc_task(parent_task, 'index-task', 'index-task',
taskgraph, label_to_taskid, graph_config, parameters)
taskgraph, label_to_taskid, parameters, graph_config)
# we need to "summarize" the scopes, otherwise a particularly
# namespace-heavy index task might have more scopes than can fit in a
@ -157,7 +157,7 @@ def add_index_tasks(taskgraph, label_to_taskid, parameters, graph_config):
for label, task in taskgraph.tasks.iteritems():
if len(task.task.get('routes', [])) <= MAX_ROUTES:
continue
added.append(make_index_task(task, taskgraph, label_to_taskid, graph_config, parameters))
added.append(make_index_task(task, taskgraph, label_to_taskid, parameters, graph_config))
if added:
taskgraph, label_to_taskid = amend_taskgraph(

Просмотреть файл

@ -4,16 +4,25 @@
from __future__ import absolute_import, print_function, unicode_literals
import os
import pytest
from taskgraph import morph
from taskgraph import morph, GECKO
from taskgraph.config import load_graph_config
from taskgraph.graph import Graph
from taskgraph.parameters import Parameters
from taskgraph.taskgraph import TaskGraph
from taskgraph.task import Task
from mozunit import main
@pytest.fixture(scope='module')
def graph_config():
return load_graph_config(os.path.join(GECKO, 'taskcluster', 'ci'))
@pytest.fixture
def make_taskgraph():
def inner(tasks):
@ -27,7 +36,7 @@ def make_taskgraph():
return inner
def test_make_index_tasks(make_taskgraph):
def test_make_index_tasks(make_taskgraph, graph_config):
task_def = {
'routes': [
"index.gecko.v2.mozilla-central.latest.firefox-l10n.linux64-opt.es-MX",
@ -79,7 +88,9 @@ def test_make_index_tasks(make_taskgraph):
docker_task.label: docker_task,
})
index_task = morph.make_index_task(task, taskgraph, label_to_taskid)
index_task = morph.make_index_task(
task, taskgraph, label_to_taskid, Parameters(strict=False), graph_config
)
assert index_task.task['payload']['command'][0] == 'insert-indexes.js'
assert index_task.task['payload']['env']['TARGET_TASKID'] == 'a-tid'