Merge mozilla-central to autoland. a=merge CLOSED TREE
[gecko.git] / taskcluster / test / test_mozilla_central.py
blob696a108db6713935af33f45990f1cbdd5edb9881
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
7 pytestmark = pytest.mark.slow
8 PARAMS = {
9 "head_repository": "https://hg.mozilla.org/mozilla-central",
10 "project": "central",
14 def test_generate_graph(optimized_task_graph):
15 """Simply tests that generating the graph does not fail."""
16 assert len(optimized_task_graph.tasks) > 0
19 @pytest.mark.parametrize(
20 "func,min_expected",
22 pytest.param(
23 lambda t: t.kind == "build" and "fuzzing" in t.attributes["build_platform"],
25 id="fuzzing builds",
29 def test_tasks_are_scheduled(optimized_task_graph, filter_tasks, func, min_expected):
30 """Ensure the specified tasks are scheduled on mozilla-central."""
31 tasks = [t.label for t in filter_tasks(optimized_task_graph, func)]
32 print(tasks)
33 assert len(tasks) >= min_expected
36 def test_test_setting(full_task_graph, filter_tasks):
37 """Verify that all test tasks' ``test-setting`` object conforms to the schema."""
38 from gecko_taskgraph.transforms.test.other import test_setting_description_schema
39 from taskgraph.util.schema import validate_schema
41 tasks = filter_tasks(full_task_graph, lambda t: t.kind == "test")
43 failures = []
44 for task in tasks:
45 try:
46 validate_schema(
47 test_setting_description_schema,
48 dict(task.task["extra"]["test-setting"]),
49 task.label,
51 except Exception as e:
52 failures.append(e)
54 if failures:
55 more = None
56 # Only display a few failures at once.
57 if len(failures) > 10:
58 more = len(failures) - 10
59 failures = failures[:10]
61 failstr = "\n\n" + "\n\n".join(str(e) for e in failures)
62 if more:
63 failstr += "\n\n" + f"... and {more} more"
65 pytest.fail(f"Task validation errors:{failstr}")
68 if __name__ == "__main__":
69 main()