fune/taskcluster/taskgraph/test/conftest.py
Andrew Halberstadt 43e87a2037 Bug 1672967 - [taskgraph.action] Fix bug in actions lookup, r=taskgraph-reviewers,jmaher
According to the documentation, actions are supposed to have an "order" system,
where the first action that applies to a task via its context, is supposed to
take precedence. But when running the match algorithm, we never break out of
the loop. So we end up applying the *last* action that matches a tasks' context.

As far as I can tell, this means we have been using the 'retrigger-disabled'
action for everything and things like retriggering Decision tasks don't work.

Differential Revision: https://phabricator.services.mozilla.com/D97351
2020-11-18 16:49:11 +00:00

52 lines
1.3 KiB
Python

# Any copyright is dedicated to the public domain.
# http://creativecommons.org/publicdomain/zero/1.0/
from __future__ import absolute_import
import os
import pytest
from mach.logging import LoggingManager
from responses import RequestsMock
from taskgraph import GECKO
from taskgraph.actions import render_actions_json
from taskgraph.config import load_graph_config
from taskgraph.parameters import Parameters
@pytest.fixture
def responses():
with RequestsMock() as rsps:
yield rsps
@pytest.fixture(scope="session", autouse=True)
def patch_prefherder(request):
from _pytest.monkeypatch import MonkeyPatch
m = MonkeyPatch()
m.setattr(
"taskgraph.util.bugbug._write_perfherder_data",
lambda lower_is_better: None,
)
yield
m.undo()
@pytest.fixture(scope="session", autouse=True)
def enable_logging():
"""Ensure logs from taskgraph are displayed when a test fails."""
lm = LoggingManager()
lm.add_terminal_logging()
@pytest.fixture(scope="session")
def graph_config():
return load_graph_config(os.path.join(GECKO, "taskcluster", "ci"))
@pytest.fixture(scope="session")
def actions_json(graph_config):
decision_task_id = "abcdef"
return render_actions_json(Parameters(strict=False), graph_config, decision_task_id)