1 # Any copyright is dedicated to the public domain.
2 # http://creativecommons.org/publicdomain/zero/1.0/
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()
13 "head_repository": "https://hg.mozilla.org/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,
24 PARAMS_NEW_CONFIG
= TRY_AUTO_PARAMETERS
.copy()
25 PARAMS_NEW_CONFIG
.update(
27 "head_repository": "https://hg.mozilla.org/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,
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(
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
)
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
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(
75 and t
.attributes
["unittest_suite"] == "mochitest-browser-chrome"
76 and t
.attributes
["test_platform"] == "linux1804-64-qr/opt"
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
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__":