test_autoland_backstop.py (1551B)
1 # Any copyright is dedicated to the public domain. 2 # http://creativecommons.org/publicdomain/zero/1.0/ 3 4 import pytest 5 from mozunit import main 6 7 pytestmark = pytest.mark.slow 8 PARAMS = { 9 "backstop": True, 10 "head_repository": "https://hg.mozilla.org/integration/autoland", 11 "project": "autoland", 12 } 13 14 15 def test_generate_graph(optimized_task_graph): 16 """Simply tests that generating the graph does not fail.""" 17 assert len(optimized_task_graph.tasks) > 0 18 19 20 @pytest.mark.parametrize( 21 "func,min_expected", 22 ( 23 pytest.param( 24 lambda t: t.kind == "build" and "fuzzing" in t.attributes["build_platform"], 25 5, 26 id="fuzzing builds", 27 ), 28 ), 29 ) 30 def test_tasks_are_scheduled(optimized_task_graph, filter_tasks, func, min_expected): 31 """Ensure the specified tasks are scheduled on mozilla-central.""" 32 tasks = [t.label for t in filter_tasks(optimized_task_graph, func)] 33 assert len(tasks) >= min_expected 34 35 36 @pytest.mark.parametrize( 37 "func", 38 ( 39 pytest.param( 40 lambda t: t.kind == "build" and "ccov" in t.attributes["build_platform"], 41 id="no ccov builds", 42 ), 43 ), 44 ) 45 def test_tasks_are_not_scheduled( 46 optimized_task_graph, filter_tasks, print_dependents, func 47 ): 48 """Ensure the specified tasks are not scheduled on autoland.""" 49 tasks = [t.label for t in filter_tasks(optimized_task_graph, func)] 50 for t in tasks: 51 print_dependents(optimized_task_graph, t) 52 assert tasks == [] 53 54 55 if __name__ == "__main__": 56 main()