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"
53 id="mochitest-browser-chrome",
57 def test_tasks_new_config_false(full_task_graph
, filter_tasks
, func
, min_expected
):
58 """Ensure when using new-test-config that we have -cf tasks and they are half the total tasks."""
59 tasks
= [t
.label
for t
in filter_tasks(full_task_graph
, func
)]
60 assert len(tasks
) == min_expected
63 t
.label
for t
in filter_tasks(full_task_graph
, func
) if t
.label
.endswith("-cf")
65 assert len(cf_tasks
) == min_expected
/ 2
68 @pytest.mark
.parametrize(
74 and t
.attributes
["unittest_suite"] == "mochitest-browser-chrome"
75 and t
.attributes
["test_platform"] == "linux1804-64-qr/opt"
78 id="mochitest-browser-chrome",
82 def test_tasks_new_config_true(
83 full_task_graph_new_config
, filter_tasks
, func
, min_expected
85 """Ensure when using new-test-config that no -cf tasks are scheduled and we have 2x the default and NO -cf."""
86 tasks
= [t
.label
for t
in filter_tasks(full_task_graph_new_config
, func
)]
87 assert len(tasks
) == min_expected
91 for t
in filter_tasks(full_task_graph_new_config
, func
)
92 if t
.label
.endswith("-cf")
94 assert len(cf_tasks
) == 0
97 if __name__
== "__main__":