| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 google.appengine.api import users | 5 from google.appengine.api import users |
| 6 | 6 |
| 7 import copy | 7 import copy |
| 8 | 8 |
| 9 import gae_ts_mon | 9 import gae_ts_mon |
| 10 | 10 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 'upper_flake_threshold': 0.98, | 117 'upper_flake_threshold': 0.98, |
| 118 'max_flake_in_a_row': 4, | 118 'max_flake_in_a_row': 4, |
| 119 'max_stable_in_a_row': 4, | 119 'max_stable_in_a_row': 4, |
| 120 'iterations_to_rerun': 100, | 120 'iterations_to_rerun': 100, |
| 121 'max_build_numbers_to_look_back': 1000, | 121 'max_build_numbers_to_look_back': 1000, |
| 122 'use_nearby_neighbor': True, | 122 'use_nearby_neighbor': True, |
| 123 'max_dive_in_a_row': 4, | 123 'max_dive_in_a_row': 4, |
| 124 'dive_rate_threshold': 0.4, | 124 'dive_rate_threshold': 0.4, |
| 125 } | 125 } |
| 126 | 126 |
| 127 _DEFAULT_CHECK_FLAKE_TRY_JOB_SETTINGS = { |
| 128 'lower_flake_threshold': 0.02, |
| 129 'upper_flake_threshold': 0.98, |
| 130 'max_flake_in_a_row': 1, |
| 131 'max_stable_in_a_row': 0, |
| 132 'max_dive_in_a_row': 4, |
| 133 'dive_rate_threshold': 0.4, |
| 134 } |
| 135 |
| 127 | 136 |
| 128 DEFAULT_CONFIG_DATA = { | 137 DEFAULT_CONFIG_DATA = { |
| 129 'steps_for_masters_rules': _DEFAULT_STEPS_FOR_MASTERS_RULES, | 138 'steps_for_masters_rules': _DEFAULT_STEPS_FOR_MASTERS_RULES, |
| 130 'builders_to_trybots': _DEFAULT_TRY_BOT_MAPPING, | 139 'builders_to_trybots': _DEFAULT_TRY_BOT_MAPPING, |
| 131 'try_job_settings': _DEFAULT_TRY_JOB_SETTINGS, | 140 'try_job_settings': _DEFAULT_TRY_JOB_SETTINGS, |
| 132 'swarming_settings': _DEFAULT_SWARMING_SETTINGS, | 141 'swarming_settings': _DEFAULT_SWARMING_SETTINGS, |
| 133 'download_build_data_settings': _DEFAULT_DOWNLOAD_BUILD_DATA_SETTINGS, | 142 'download_build_data_settings': _DEFAULT_DOWNLOAD_BUILD_DATA_SETTINGS, |
| 134 'action_settings': _DEFAULT_ACTION_SETTINGS, | 143 'action_settings': _DEFAULT_ACTION_SETTINGS, |
| 135 'check_flake_settings': _DEFAULT_CHECK_FLAKE_SETTINGS, | 144 'check_flake_settings': _DEFAULT_CHECK_FLAKE_SETTINGS, |
| 145 'check_flake_try_job_settings': _DEFAULT_CHECK_FLAKE_TRY_JOB_SETTINGS, |
| 136 } | 146 } |
| 137 | 147 |
| 138 | 148 |
| 139 class WaterfallTestCase(TestCase): # pragma: no cover. | 149 class WaterfallTestCase(TestCase): # pragma: no cover. |
| 140 | 150 |
| 141 def UpdateUnitTestConfigSettings(self, config_property=None, | 151 def UpdateUnitTestConfigSettings(self, config_property=None, |
| 142 override_data=None): | 152 override_data=None): |
| 143 """Sets up Findit's config for unit tests. | 153 """Sets up Findit's config for unit tests. |
| 144 | 154 |
| 145 Args: | 155 Args: |
| 146 config_property: The name of the config property to update. | 156 config_property: The name of the config property to update. |
| 147 override_data: A dict to override any default settings. | 157 override_data: A dict to override any default settings. |
| 148 """ | 158 """ |
| 149 config_data = DEFAULT_CONFIG_DATA | 159 config_data = DEFAULT_CONFIG_DATA |
| 150 | 160 |
| 151 if config_property and override_data: | 161 if config_property and override_data: |
| 152 config_data = copy.deepcopy(DEFAULT_CONFIG_DATA) | 162 config_data = copy.deepcopy(DEFAULT_CONFIG_DATA) |
| 153 config_data[config_property].update(override_data) | 163 config_data[config_property].update(override_data) |
| 154 | 164 |
| 155 FinditConfig.Get().Update(users.User(email='admin@chromium.org'), True, | 165 FinditConfig.Get().Update(users.User(email='admin@chromium.org'), True, |
| 156 **config_data) | 166 **config_data) |
| 157 | 167 |
| 158 def setUp(self): | 168 def setUp(self): |
| 159 super(WaterfallTestCase, self).setUp() | 169 super(WaterfallTestCase, self).setUp() |
| 160 self.UpdateUnitTestConfigSettings() | 170 self.UpdateUnitTestConfigSettings() |
| 161 self.maxDiff = None | 171 self.maxDiff = None |
| 162 gae_ts_mon.reset_for_unittest(disable=True) | 172 gae_ts_mon.reset_for_unittest(disable=True) |
| OLD | NEW |