summaryrefslogtreecommitdiffstats
path: root/taskcluster/gecko_taskgraph/test
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
commitfbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 (patch)
tree4c1ccaf5486d4f2009f9a338a98a83e886e29c97 /taskcluster/gecko_taskgraph/test
parentReleasing progress-linux version 124.0.1-1~progress7.99u1. (diff)
downloadfirefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.tar.xz
firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.zip
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'taskcluster/gecko_taskgraph/test')
-rw-r--r--taskcluster/gecko_taskgraph/test/test_morph.py96
-rw-r--r--taskcluster/gecko_taskgraph/test/test_target_tasks.py15
-rw-r--r--taskcluster/gecko_taskgraph/test/test_util_partials.py32
3 files changed, 135 insertions, 8 deletions
diff --git a/taskcluster/gecko_taskgraph/test/test_morph.py b/taskcluster/gecko_taskgraph/test/test_morph.py
index c29fb58207..c3c499769c 100644
--- a/taskcluster/gecko_taskgraph/test/test_morph.py
+++ b/taskcluster/gecko_taskgraph/test/test_morph.py
@@ -26,6 +26,102 @@ def make_taskgraph():
return inner
+@pytest.mark.parametrize(
+ "params,expected",
+ (
+ pytest.param(
+ {
+ "try_mode": "try_task_config",
+ "try_task_config": {
+ "rebuild": 10,
+ "tasks": ["b"],
+ },
+ "project": "try",
+ },
+ {"b": 10},
+ id="duplicates no chunks",
+ ),
+ pytest.param(
+ {
+ "try_mode": "try_task_config",
+ "try_task_config": {
+ "rebuild": 10,
+ "tasks": ["a-*"],
+ },
+ "project": "try",
+ },
+ {"a-1": 10, "a-2": 10},
+ id="duplicates with chunks",
+ ),
+ pytest.param(
+ {
+ "try_mode": "try_task_config",
+ "try_task_config": {
+ "rebuild": 10,
+ "tasks": ["a-*", "b"],
+ },
+ "project": "try",
+ },
+ {"a-1": 10, "a-2": 10, "b": 10},
+ id="duplicates with and without chunks",
+ ),
+ pytest.param(
+ {
+ "try_mode": "try_task_config",
+ "try_task_config": {
+ "tasks": ["a-*"],
+ },
+ "project": "try",
+ },
+ {"a-1": -1, "a-2": -1},
+ id="no rebuild, no duplicates",
+ ),
+ pytest.param(
+ {
+ "try_mode": "try_task_config",
+ "try_task_config": {
+ "rebuild": 0,
+ "tasks": ["a-*"],
+ },
+ "project": "try",
+ },
+ {"a-1": -1, "a-2": -1},
+ id="rebuild of zero",
+ ),
+ pytest.param(
+ {
+ "try_mode": "try_task_config",
+ "try_task_config": {
+ "rebuild": 100,
+ "tasks": ["a-*"],
+ },
+ "project": "try",
+ },
+ {"a-1": 100, "a-2": 100},
+ id="rebuild 100",
+ ),
+ ),
+)
+def test_try_task_duplicates(make_taskgraph, graph_config, params, expected):
+ taskb = Task(kind="test", label="b", attributes={}, task={})
+ task1 = Task(kind="test", label="a-1", attributes={}, task={})
+ task2 = Task(kind="test", label="a-2", attributes={}, task={})
+ taskgraph, label_to_taskid = make_taskgraph(
+ {
+ taskb.label: taskb,
+ task1.label: task1,
+ task2.label: task2,
+ }
+ )
+
+ taskgraph, label_to_taskid = morph._add_try_task_duplicates(
+ taskgraph, label_to_taskid, params, graph_config
+ )
+ for label in expected:
+ task = taskgraph.tasks[label]
+ assert task.attributes.get("task_duplicates", -1) == expected[label]
+
+
def test_make_index_tasks(make_taskgraph, graph_config):
task_def = {
"routes": [
diff --git a/taskcluster/gecko_taskgraph/test/test_target_tasks.py b/taskcluster/gecko_taskgraph/test/test_target_tasks.py
index 2bbc57fcf3..22582f9040 100644
--- a/taskcluster/gecko_taskgraph/test/test_target_tasks.py
+++ b/taskcluster/gecko_taskgraph/test/test_target_tasks.py
@@ -210,6 +210,21 @@ class TestTargetTasks(unittest.TestCase):
}
self.assertEqual(sorted(method(tg, params, {})), ["ddd-1", "ddd-2"])
+ def test_try_task_config_regex_with_paths(self):
+ "try_mode = try_task_config uses the try config with regex instead of chunk numbers"
+ tg = self.make_task_graph()
+ method = target_tasks.get_method("try_tasks")
+ params = {
+ "try_mode": "try_task_config",
+ "try_task_config": {
+ "new-test-config": True,
+ "tasks": ["ddd-*"],
+ "env": {"MOZHARNESS_TEST_PATHS": "foo/bar"},
+ },
+ "project": "try",
+ }
+ self.assertEqual(sorted(method(tg, params, {})), ["ddd-1"])
+
def test_try_task_config_absolute(self):
"try_mode = try_task_config uses the try config with full task labels"
tg = self.make_task_graph()
diff --git a/taskcluster/gecko_taskgraph/test/test_util_partials.py b/taskcluster/gecko_taskgraph/test/test_util_partials.py
index 3630d7b0ec..4f8bea8662 100644
--- a/taskcluster/gecko_taskgraph/test/test_util_partials.py
+++ b/taskcluster/gecko_taskgraph/test/test_util_partials.py
@@ -30,18 +30,34 @@ release_blob = {
def nightly_blob(release):
- return {
- "platforms": {
- "WINNT_x86_64-msvc": {
- "locales": {
- "en-US": {
- "buildID": release[-14:],
- "completes": [{"fileUrl": release}],
+ # Added for bug 1883046, where we identified a case where a Balrog release
+ # that does not contain completes will throw an unnecessary exception.
+ if release == "Firefox-mozilla-central-nightly-20211001214601":
+ return {
+ "platforms": {
+ "WINNT_x86_64-msvc": {
+ "locales": {
+ "en-US": {
+ "buildID": release[-14:],
+ "partials": [{"fileUrl": release}],
+ }
+ }
+ }
+ }
+ }
+ else:
+ return {
+ "platforms": {
+ "WINNT_x86_64-msvc": {
+ "locales": {
+ "en-US": {
+ "buildID": release[-14:],
+ "completes": [{"fileUrl": release}],
+ }
}
}
}
}
- }
class TestReleaseHistory(unittest.TestCase):