Bug 1885993 - Enable the BackupService initializer on Nightly by default. r=backup...
[gecko.git] / taskcluster / test / test_new_config.py
blob2410bc01a4e8123f1e8ddd8cc51121839dd9f6c2
1 # Any copyright is dedicated to the public domain.
2 # http://creativecommons.org/publicdomain/zero/1.0/
4 import pytest
5 from mozunit import main
6 from tryselect.selectors.auto import TRY_AUTO_PARAMETERS
8 pytestmark = pytest.mark.slow
10 PARAMS = TRY_AUTO_PARAMETERS.copy()
11 PARAMS.update(
13 "head_repository": "https://hg.mozilla.org/try",
14 "project": "try",
15 "target_kind": "test",
16 # These ensure this isn't considered a backstop. The pushdate must
17 # be slightly higher than the one in data/pushes.json, and
18 # pushlog_id must not be a multiple of 10.
19 "pushdate": 1593029536,
20 "pushlog_id": "2",
24 PARAMS_NEW_CONFIG = TRY_AUTO_PARAMETERS.copy()
25 PARAMS_NEW_CONFIG.update(
27 "head_repository": "https://hg.mozilla.org/try",
28 "project": "try",
29 "target_kind": "test",
30 # These ensure this isn't considered a backstop. The pushdate must
31 # be slightly higher than the one in data/pushes.json, and
32 # pushlog_id must not be a multiple of 10.
33 "pushdate": 1593029536,
34 "pushlog_id": "2",
35 "try_task_config": {"new-test-config": True},
36 "try_mode": "try_task_config",
37 "target_tasks_method": "try_tasks",
38 "test_manifest_loader": "default",
43 @pytest.mark.parametrize(
44 "func,min_expected",
46 pytest.param(
47 lambda t: (
48 t.kind == "test"
49 and t.attributes["unittest_suite"] == "mochitest-browser-chrome"
50 and t.attributes["test_platform"] == "linux1804-64-qr/opt"
51 and ("spi-nw" not in t.label and "a11y-checks" not in t.label)
53 32,
54 id="mochitest-browser-chrome",
58 def test_tasks_new_config_false(full_task_graph, filter_tasks, func, min_expected):
59 """Ensure when using new-test-config that we have -cf tasks and they are half the total tasks."""
60 tasks = [t.label for t in filter_tasks(full_task_graph, func)]
61 assert len(tasks) == min_expected
63 cf_tasks = [
64 t.label for t in filter_tasks(full_task_graph, func) if t.label.endswith("-cf")
66 assert len(cf_tasks) == min_expected / 2
69 @pytest.mark.parametrize(
70 "func,min_expected",
72 pytest.param(
73 lambda t: (
74 t.kind == "test"
75 and t.attributes["unittest_suite"] == "mochitest-browser-chrome"
76 and t.attributes["test_platform"] == "linux1804-64-qr/opt"
78 64,
79 id="mochitest-browser-chrome",
83 def test_tasks_new_config_true(
84 full_task_graph_new_config, filter_tasks, func, min_expected
86 """Ensure when using new-test-config that no -cf tasks are scheduled and we have 2x the default and NO -cf."""
87 tasks = [t.label for t in filter_tasks(full_task_graph_new_config, func)]
88 assert len(tasks) == min_expected
90 cf_tasks = [
91 t.label
92 for t in filter_tasks(full_task_graph_new_config, func)
93 if t.label.endswith("-cf")
95 assert len(cf_tasks) == 0
98 if __name__ == "__main__":
99 main()