| 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 from common.findit_testcase import FinditTestCase | 9 from common.findit_testcase import FinditTestCase |
| 10 from model.wf_config import FinditConfig | 10 from model.wf_config import FinditConfig |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 'use_chrome_build_extract': True | 98 'use_chrome_build_extract': True |
| 99 } | 99 } |
| 100 | 100 |
| 101 | 101 |
| 102 _DEFAULT_ACTION_SETTINGS = { | 102 _DEFAULT_ACTION_SETTINGS = { |
| 103 'cr_notification_build_threshold': 2, | 103 'cr_notification_build_threshold': 2, |
| 104 'cr_notification_latency_limit_minutes': 30, | 104 'cr_notification_latency_limit_minutes': 30, |
| 105 } | 105 } |
| 106 | 106 |
| 107 | 107 |
| 108 _DEFAULT_CHECK_FLAKE_SETTINGS = { |
| 109 'lower_flake_threshold': 0.02, |
| 110 'upper_flake_threshold': 0.98, |
| 111 'max_flake_in_a_row': 4, |
| 112 'max_stable_in_a_row': 4 |
| 113 } |
| 114 |
| 115 |
| 108 DEFAULT_CONFIG_DATA = { | 116 DEFAULT_CONFIG_DATA = { |
| 109 'steps_for_masters_rules': _DEFAULT_STEPS_FOR_MASTERS_RULES, | 117 'steps_for_masters_rules': _DEFAULT_STEPS_FOR_MASTERS_RULES, |
| 110 'builders_to_trybots': _DEFAULT_TRY_BOT_MAPPING, | 118 'builders_to_trybots': _DEFAULT_TRY_BOT_MAPPING, |
| 111 'try_job_settings': _DEFAULT_TRY_JOB_SETTINGS, | 119 'try_job_settings': _DEFAULT_TRY_JOB_SETTINGS, |
| 112 'swarming_settings': _DEFAULT_SWARMING_SETTINGS, | 120 'swarming_settings': _DEFAULT_SWARMING_SETTINGS, |
| 113 'download_build_data_settings': _DEFAULT_DOWNLOAD_BUILD_DATA_SETTINGS, | 121 'download_build_data_settings': _DEFAULT_DOWNLOAD_BUILD_DATA_SETTINGS, |
| 114 'action_settings': _DEFAULT_ACTION_SETTINGS, | 122 'action_settings': _DEFAULT_ACTION_SETTINGS, |
| 123 'check_flake_settings': _DEFAULT_CHECK_FLAKE_SETTINGS |
| 115 } | 124 } |
| 116 | 125 |
| 117 | 126 |
| 118 class WaterfallTestCase(FinditTestCase): # pragma: no cover. | 127 class WaterfallTestCase(FinditTestCase): # pragma: no cover. |
| 119 | 128 |
| 120 def UpdateUnitTestConfigSettings(self, config_property=None, | 129 def UpdateUnitTestConfigSettings(self, config_property=None, |
| 121 override_data=None): | 130 override_data=None): |
| 122 """Sets up Findit's config for unit tests. | 131 """Sets up Findit's config for unit tests. |
| 123 | 132 |
| 124 Args: | 133 Args: |
| 125 config_property: The name of the config property to update. | 134 config_property: The name of the config property to update. |
| 126 override_data: A dict to override any default settings. | 135 override_data: A dict to override any default settings. |
| 127 """ | 136 """ |
| 128 config_data = DEFAULT_CONFIG_DATA | 137 config_data = DEFAULT_CONFIG_DATA |
| 129 | 138 |
| 130 if config_property and override_data: | 139 if config_property and override_data: |
| 131 config_data = copy.deepcopy(DEFAULT_CONFIG_DATA) | 140 config_data = copy.deepcopy(DEFAULT_CONFIG_DATA) |
| 132 config_data[config_property].update(override_data) | 141 config_data[config_property].update(override_data) |
| 133 | 142 |
| 134 FinditConfig.Get().Update(users.User(email='admin@chromium.org'), True, | 143 FinditConfig.Get().Update(users.User(email='admin@chromium.org'), True, |
| 135 **config_data) | 144 **config_data) |
| 136 | 145 |
| 137 def setUp(self): | 146 def setUp(self): |
| 138 super(WaterfallTestCase, self).setUp() | 147 super(WaterfallTestCase, self).setUp() |
| 139 self.UpdateUnitTestConfigSettings() | 148 self.UpdateUnitTestConfigSettings() |
| OLD | NEW |