summaryrefslogtreecommitdiffstats
path: root/taskcluster/test/test_new_config.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /taskcluster/test/test_new_config.py
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'taskcluster/test/test_new_config.py')
-rw-r--r--taskcluster/test/test_new_config.py98
1 files changed, 98 insertions, 0 deletions
diff --git a/taskcluster/test/test_new_config.py b/taskcluster/test/test_new_config.py
new file mode 100644
index 0000000000..a233dce97b
--- /dev/null
+++ b/taskcluster/test/test_new_config.py
@@ -0,0 +1,98 @@
+# Any copyright is dedicated to the public domain.
+# http://creativecommons.org/publicdomain/zero/1.0/
+
+import pytest
+from mozunit import main
+from tryselect.selectors.auto import TRY_AUTO_PARAMETERS
+
+pytestmark = pytest.mark.slow
+
+PARAMS = TRY_AUTO_PARAMETERS.copy()
+PARAMS.update(
+ {
+ "head_repository": "https://hg.mozilla.org/try",
+ "project": "try",
+ "target_kind": "test",
+ # These ensure this isn't considered a backstop. The pushdate must
+ # be slightly higher than the one in data/pushes.json, and
+ # pushlog_id must not be a multiple of 10.
+ "pushdate": 1593029536,
+ "pushlog_id": "2",
+ }
+)
+
+PARAMS_NEW_CONFIG = TRY_AUTO_PARAMETERS.copy()
+PARAMS_NEW_CONFIG.update(
+ {
+ "head_repository": "https://hg.mozilla.org/try",
+ "project": "try",
+ "target_kind": "test",
+ # These ensure this isn't considered a backstop. The pushdate must
+ # be slightly higher than the one in data/pushes.json, and
+ # pushlog_id must not be a multiple of 10.
+ "pushdate": 1593029536,
+ "pushlog_id": "2",
+ "try_task_config": {"new-test-config": True},
+ "try_mode": "try_task_config",
+ "target_tasks_method": "try_tasks",
+ "test_manifest_loader": "default",
+ }
+)
+
+
+@pytest.mark.parametrize(
+ "func,min_expected",
+ (
+ pytest.param(
+ lambda t: (
+ t.kind == "test"
+ and t.attributes["unittest_suite"] == "mochitest-browser-chrome"
+ and t.attributes["test_platform"] == "linux1804-64-qr/opt"
+ ),
+ 64,
+ id="mochitest-browser-chrome",
+ ),
+ ),
+)
+def test_tasks_new_config_false(full_task_graph, filter_tasks, func, min_expected):
+ """Ensure when using new-test-config that we have -cf tasks and they are half the total tasks."""
+ tasks = [t.label for t in filter_tasks(full_task_graph, func)]
+ assert len(tasks) == min_expected
+
+ cf_tasks = [
+ t.label for t in filter_tasks(full_task_graph, func) if t.label.endswith("-cf")
+ ]
+ assert len(cf_tasks) == min_expected / 2
+
+
+@pytest.mark.parametrize(
+ "func,min_expected",
+ (
+ pytest.param(
+ lambda t: (
+ t.kind == "test"
+ and t.attributes["unittest_suite"] == "mochitest-browser-chrome"
+ and t.attributes["test_platform"] == "linux1804-64-qr/opt"
+ ),
+ 64,
+ id="mochitest-browser-chrome",
+ ),
+ ),
+)
+def test_tasks_new_config_true(
+ full_task_graph_new_config, filter_tasks, func, min_expected
+):
+ """Ensure when using new-test-config that no -cf tasks are scheduled and we have 2x the default and NO -cf."""
+ tasks = [t.label for t in filter_tasks(full_task_graph_new_config, func)]
+ assert len(tasks) == min_expected
+
+ cf_tasks = [
+ t.label
+ for t in filter_tasks(full_task_graph_new_config, func)
+ if t.label.endswith("-cf")
+ ]
+ assert len(cf_tasks) == 0
+
+
+if __name__ == "__main__":
+ main()