commit 62219df14b158c2f84a045cb8dbd727a2a3ac0b5
parent 6376725ec8e5130aa9b6f94d1caedea0b9cb1b51
Author: Andrew Halberstadt <ahal@mozilla.com>
Date: Wed, 22 Oct 2025 18:22:22 +0000
Bug 1990567 - Update gecko_taskgraph / tryselect test expectations, r=releng-reviewers,taskgraph-reviewers,jcristau
Taskgraph now uses the Taskcluster client library, which url encodes the
artifact path prior to making the request.
Differential Revision: https://phabricator.services.mozilla.com/D269603
Diffstat:
4 files changed, 28 insertions(+), 12 deletions(-)
diff --git a/taskcluster/gecko_taskgraph/test/test_optimize_strategies.py b/taskcluster/gecko_taskgraph/test/test_optimize_strategies.py
@@ -587,14 +587,15 @@ def test_mozlint_should_remove_task2(
assert result == expected
-def test_skip_unless_missing(responses, params, session_mocker):
+def test_skip_unless_missing(monkeypatch, responses, params):
opt = SkipUnlessMissing()
task = deepcopy(default_tasks[0])
task.task["deadline"] = "2024-01-02T00:00:00.000Z"
index = "foo.bar.baz"
task_id = "abc"
- root_url = "https://firefox-ci-tc.services.mozilla.com"
- session_mocker.patch.dict("os.environ", {"TASKCLUSTER_ROOT_URL": root_url})
+ root_url = "https://taskcluster.example.com"
+ monkeypatch.delenv("TASKCLUSTER_PROXY_URL", raising=False)
+ monkeypatch.setenv("TASKCLUSTER_ROOT_URL", root_url)
# Task is missing, don't optimize
responses.add(
diff --git a/taskcluster/gecko_taskgraph/test/test_util_backstop.py b/taskcluster/gecko_taskgraph/test/test_util_backstop.py
@@ -148,10 +148,16 @@ def params():
),
)
def test_is_backstop(
- responses, params, response_args, extra_params, expected, session_mocker
+ monkeypatch,
+ responses,
+ params,
+ response_args,
+ extra_params,
+ expected,
):
- root_url = "https://firefox-ci-tc.services.mozilla.com"
- session_mocker.patch.dict("os.environ", {"TASKCLUSTER_ROOT_URL": root_url})
+ root_url = "https://taskcluster.example.com"
+ monkeypatch.delenv("TASKCLUSTER_PROXY_URL", raising=False)
+ monkeypatch.setenv("TASKCLUSTER_ROOT_URL", root_url)
urls = {
"index": get_index_url(
diff --git a/taskcluster/test/conftest.py b/taskcluster/test/conftest.py
@@ -14,6 +14,7 @@ from taskgraph.generator import TaskGraphGenerator
from taskgraph.parameters import parameters_loader
here = os.path.abspath(os.path.dirname(__file__))
+ROOT_URL = "https://firefox-ci-tc.services.mozilla.com"
@pytest.fixture(scope="session")
@@ -68,7 +69,9 @@ def create_tgg(responses, datadir):
# Still allow other real requests.
responses.add_passthru("https://hg.mozilla.org")
- responses.add_passthru("https://firefox-ci-tc.services.mozilla.com")
+ responses.add_passthru(ROOT_URL)
+ if proxy_url := os.environ.get("TASKCLUSTER_PROXY_URL"):
+ responses.add_passthru(proxy_url)
return tgg
return inner
diff --git a/tools/tryselect/test/test_task_configs.py b/tools/tryselect/test/test_task_configs.py
@@ -10,7 +10,7 @@ import mozunit
import pytest
from tryselect.task_config import Pernosco, all_task_configs
-TC_URL = "https://firefox-ci-tc.services.mozilla.com"
+TC_URL = "https://taskcluster.example.com"
TH_URL = "https://treeherder.mozilla.org"
# task configs have a list of tests of the form (input, expected)
@@ -150,6 +150,12 @@ def config_patch_resolver(patch_resolver):
return inner
+@pytest.fixture(autouse=True)
+def mock_root_url(monkeypatch):
+ monkeypatch.delenv("TASKCLUSTER_PROXY_URL", raising=False)
+ monkeypatch.setenv("TASKCLUSTER_ROOT_URL", TC_URL)
+
+
def test_task_configs(config_patch_resolver, task_config, args, expected):
parser = ArgumentParser()
@@ -201,7 +207,7 @@ def test_pernosco(patch_ssh_user):
assert params == {"try_task_config": {"env": {"PERNOSCO": "1"}, "pernosco": True}}
-def test_exisiting_tasks(responses, patch_ssh_user):
+def test_exisiting_tasks(mocker, responses, patch_ssh_user):
parser = ArgumentParser()
cfg = all_task_configs["existing-tasks"]()
cfg.add_arguments(parser)
@@ -228,7 +234,7 @@ def test_exisiting_tasks(responses, patch_ssh_user):
responses.add(
responses.GET,
- f"{TC_URL}/api/queue/v1/task/{task_id}/artifacts/public/label-to-taskid.json",
+ f"{TC_URL}/api/queue/v1/task/{task_id}/artifacts/public%2flabel-to-taskid.json",
json=label_to_taskid,
)
@@ -254,7 +260,7 @@ def test_exisiting_tasks_task_id(responses):
responses.add(
responses.GET,
- f"{TC_URL}/api/queue/v1/task/{task_id}/artifacts/public/label-to-taskid.json",
+ f"{TC_URL}/api/queue/v1/task/{task_id}/artifacts/public%2flabel-to-taskid.json",
json=label_to_taskid,
)
@@ -282,7 +288,7 @@ def test_exisiting_tasks_rev(responses):
responses.add(
responses.GET,
- f"{TC_URL}/api/queue/v1/task/{task_id}/artifacts/public/label-to-taskid.json",
+ f"{TC_URL}/api/queue/v1/task/{task_id}/artifacts/public%2flabel-to-taskid.json",
json=label_to_taskid,
)