| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 from testing_utils import testing | 5 from model.test import configured_test_case |
| 6 | |
| 7 from model.wf_config import FinditConfig | |
| 8 from waterfall import waterfall_config | 6 from waterfall import waterfall_config |
| 9 | 7 |
| 10 | 8 |
| 11 class MastersTest(testing.AppengineTestCase): | 9 class MastersTest(configured_test_case.ConfiguredTestCase): |
| 12 | |
| 13 def setUp(self): | |
| 14 super(MastersTest, self).setUp() | |
| 15 self.mock_current_user(user_email='test@chromium.org', is_admin=True) | |
| 16 | |
| 17 config_data = { | |
| 18 'steps_for_masters_rules': { | |
| 19 'supported_masters': { | |
| 20 'master1': { | |
| 21 # supported_steps override global. | |
| 22 'supported_steps': ['step6'], | |
| 23 'unsupported_steps': ['step1', 'step2', 'step3'], | |
| 24 }, | |
| 25 'master2': { | |
| 26 # Only supports step4 and step5 regardless of global. | |
| 27 'supported_steps': ['step4', 'step5'], | |
| 28 'check_global': False | |
| 29 }, | |
| 30 'master3': { | |
| 31 # Supports everything not blacklisted in global. | |
| 32 }, | |
| 33 }, | |
| 34 'global': { | |
| 35 # Blacklists all listed steps for all masters unless overridden. | |
| 36 'unsupported_steps': ['step6', 'step7'], | |
| 37 } | |
| 38 }, | |
| 39 'builders_to_trybots': { | |
| 40 'master1': { | |
| 41 'builder1': { | |
| 42 'mastername': 'tryserver1', | |
| 43 'buildername': 'trybot1', | |
| 44 'strict_regex': True, | |
| 45 } | |
| 46 } | |
| 47 }, | |
| 48 'try_job_settings': { | |
| 49 'server_query_interval_seconds': 60, | |
| 50 'job_timeout_hours': 5, | |
| 51 'allowed_response_error_times': 1 | |
| 52 }, | |
| 53 'swarming_settings': { | |
| 54 'server_host': 'chromium-swarm.appspot.com', | |
| 55 'default_request_priority': 150, | |
| 56 'request_expiration_hours': 20, | |
| 57 'server_query_interval_seconds': 60, | |
| 58 'task_timeout_hours': 23, | |
| 59 'isolated_server': 'https://isolateserver.appspot.com', | |
| 60 'isolated_storage_url': 'isolateserver.storage.googleapis.com', | |
| 61 'iterations_to_rerun': 10 | |
| 62 } | |
| 63 } | |
| 64 | |
| 65 FinditConfig.Get().Update(**config_data) | |
| 66 | 10 |
| 67 def testConvertOldMastersFormatToNew(self): | 11 def testConvertOldMastersFormatToNew(self): |
| 68 self.assertEqual( | 12 self.assertEqual( |
| 69 { | 13 { |
| 70 'supported_masters': { | 14 'supported_masters': { |
| 71 'master1': { | 15 'master1': { |
| 72 'unsupported_steps': ['1', '2'] | 16 'unsupported_steps': ['1', '2'] |
| 73 }, | 17 }, |
| 74 'master2': {} | 18 'master2': {} |
| 75 }, | 19 }, |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 waterfall_config.GetTrybotForWaterfallBuilder('master1', 'builder1')) | 71 waterfall_config.GetTrybotForWaterfallBuilder('master1', 'builder1')) |
| 128 self.assertEqual( | 72 self.assertEqual( |
| 129 (None, None), | 73 (None, None), |
| 130 waterfall_config.GetTrybotForWaterfallBuilder('master2', 'builder2')) | 74 waterfall_config.GetTrybotForWaterfallBuilder('master2', 'builder2')) |
| 131 | 75 |
| 132 def testGetTryJobSettings(self): | 76 def testGetTryJobSettings(self): |
| 133 self.assertEqual( | 77 self.assertEqual( |
| 134 { | 78 { |
| 135 'server_query_interval_seconds': 60, | 79 'server_query_interval_seconds': 60, |
| 136 'job_timeout_hours': 5, | 80 'job_timeout_hours': 5, |
| 137 'allowed_response_error_times': 1 | 81 'allowed_response_error_times': 5 |
| 138 }, | 82 }, |
| 139 waterfall_config.GetTryJobSettings()) | 83 waterfall_config.GetTryJobSettings()) |
| 140 | 84 |
| 141 def testGetSwarmingSettings(self): | 85 def testGetSwarmingSettings(self): |
| 142 self.assertEqual( | 86 self.assertEqual( |
| 143 { | 87 { |
| 144 'server_host': 'chromium-swarm.appspot.com', | 88 'server_host': 'chromium-swarm.appspot.com', |
| 145 'default_request_priority': 150, | 89 'default_request_priority': 150, |
| 146 'request_expiration_hours': 20, | 90 'request_expiration_hours': 20, |
| 147 'server_query_interval_seconds': 60, | 91 'server_query_interval_seconds': 60, |
| 148 'task_timeout_hours': 23, | 92 'task_timeout_hours': 23, |
| 149 'isolated_server': 'https://isolateserver.appspot.com', | 93 'isolated_server': 'https://isolateserver.appspot.com', |
| 150 'isolated_storage_url': 'isolateserver.storage.googleapis.com', | 94 'isolated_storage_url': 'isolateserver.storage.googleapis.com', |
| 151 'iterations_to_rerun': 10 | 95 'iterations_to_rerun': 10 |
| 152 }, | 96 }, |
| 153 waterfall_config.GetSwarmingSettings()) | 97 waterfall_config.GetSwarmingSettings()) |
| 154 | 98 |
| 155 def testEnableStrictRegexForCompileLinkFailures(self): | 99 def testEnableStrictRegexForCompileLinkFailures(self): |
| 156 self.assertFalse( | 100 self.assertFalse( |
| 157 waterfall_config.EnableStrictRegexForCompileLinkFailures('m', 'b')) | 101 waterfall_config.EnableStrictRegexForCompileLinkFailures('m', 'b')) |
| 158 self.assertTrue( | 102 self.assertTrue( |
| 159 waterfall_config.EnableStrictRegexForCompileLinkFailures( | 103 waterfall_config.EnableStrictRegexForCompileLinkFailures( |
| 160 'master1', 'builder1')) | 104 'master1', 'builder1')) |
| OLD | NEW |