Commit 05c87fca authored by Andrew Halberstadt's avatar Andrew Halberstadt
Browse files

Bug 1624437 - [taskgraph] Handle the upcoming data format in the bugbug...

Bug 1624437 - [taskgraph] Handle the upcoming data format in the bugbug optimization strategy, DONTBUILD, r=marco

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

--HG--
extra : moz-landing-system : lando
parent fe363faa
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -57,8 +57,8 @@ class BugBugPushSchedules(OptimizationStrategy):

        test_manifests = task.attributes.get('test_manifests')
        if test_manifests is None:
            if task.label in data.get('tasks', []):
            if task.label in data.get('tasks', {}):
                return False
            return True

        return not bool(set(task.attributes['test_manifests']) & set(data.get('groups', [])))
        return not bool(set(task.attributes['test_manifests']) & set(data.get('groups', {})))
+7 −3
Original line number Diff line number Diff line
@@ -51,19 +51,23 @@ def tasks(generate_tasks):
@pytest.mark.parametrize("data,expected", [
    pytest.param({}, [], id='empty'),
    pytest.param(
        {'tasks': ['task-1', 'task-2', 'task-3']},
        {'tasks': {'task-1': 0.9, 'task-2': 0.1, 'task-3': 0.5}},
        ['task-2'],
        id='only tasks without test manifests selected'
    ),
    pytest.param(
        {'groups': ['foo/test.ini']},
        {'groups': {'foo/test.ini': 0.4}},
        ['task-0'],
        id='tasks containing group selected',
    ),
    pytest.param(
        {'tasks': ['task-2'], 'groups': ['foo/test.ini', 'bar/test.ini']},
        {'tasks': {'task-2': 0.2}, 'groups': {'foo/test.ini': 0.25, 'bar/test.ini': 0.75}},
        ['task-0', 'task-1', 'task-2'],
        id='tasks matching "tasks" or "groups" selected'),
    pytest.param(
        {'tasks': ['task-2'], 'groups': ['foo/test.ini', 'bar/test.ini']},
        ['task-0', 'task-1', 'task-2'],
        id='test old format'),
])
def test_bugbug_push_schedules(responses, params, tasks, data, expected):
    query = "/push/{branch}/{head_rev}/schedules".format(**params)