| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 'server_host': 'chromium-swarm.appspot.com', | 83 'server_host': 'chromium-swarm.appspot.com', |
| 84 'default_request_priority': 150, | 84 'default_request_priority': 150, |
| 85 'request_expiration_hours': 20, | 85 'request_expiration_hours': 20, |
| 86 'server_query_interval_seconds': 60, | 86 'server_query_interval_seconds': 60, |
| 87 'task_timeout_hours': 23, | 87 'task_timeout_hours': 23, |
| 88 'isolated_server': 'https://isolateserver.appspot.com', | 88 'isolated_server': 'https://isolateserver.appspot.com', |
| 89 'isolated_storage_url': 'isolateserver.storage.googleapis.com', | 89 'isolated_storage_url': 'isolateserver.storage.googleapis.com', |
| 90 'iterations_to_rerun': 10 | 90 'iterations_to_rerun': 10 |
| 91 } | 91 } |
| 92 | 92 |
| 93 |
| 93 _DEFAULT_DOWNLOAD_BUILD_DATA_SETTINGS = { | 94 _DEFAULT_DOWNLOAD_BUILD_DATA_SETTINGS = { |
| 94 'download_interval_seconds': 10, | 95 'download_interval_seconds': 10, |
| 95 'memcache_master_download_expiration_seconds': 3600, | 96 'memcache_master_download_expiration_seconds': 3600, |
| 96 'use_chrome_build_extract': True | 97 'use_chrome_build_extract': True |
| 97 } | 98 } |
| 98 | 99 |
| 100 |
| 101 _DEFAULT_ACTION_SETTINGS = { |
| 102 'cr_notification_build_threshold': 2, |
| 103 'cr_notification_latency_limit_minutes': 30, |
| 104 } |
| 105 |
| 106 |
| 99 DEFAULT_CONFIG_DATA = { | 107 DEFAULT_CONFIG_DATA = { |
| 100 'steps_for_masters_rules': _DEFAULT_STEPS_FOR_MASTERS_RULES, | 108 'steps_for_masters_rules': _DEFAULT_STEPS_FOR_MASTERS_RULES, |
| 101 'builders_to_trybots': _DEFAULT_TRY_BOT_MAPPING, | 109 'builders_to_trybots': _DEFAULT_TRY_BOT_MAPPING, |
| 102 'try_job_settings': _DEFAULT_TRY_JOB_SETTINGS, | 110 'try_job_settings': _DEFAULT_TRY_JOB_SETTINGS, |
| 103 'swarming_settings': _DEFAULT_SWARMING_SETTINGS, | 111 'swarming_settings': _DEFAULT_SWARMING_SETTINGS, |
| 104 'download_build_data_settings': _DEFAULT_DOWNLOAD_BUILD_DATA_SETTINGS | 112 'download_build_data_settings': _DEFAULT_DOWNLOAD_BUILD_DATA_SETTINGS, |
| 113 'action_settings': _DEFAULT_ACTION_SETTINGS, |
| 105 } | 114 } |
| 106 | 115 |
| 107 | 116 |
| 108 class WaterfallTestCase(FinditTestCase): # pragma: no cover. | 117 class WaterfallTestCase(FinditTestCase): # pragma: no cover. |
| 109 | 118 |
| 110 def UpdateUnitTestConfigSettings(self, config_property=None, | 119 def UpdateUnitTestConfigSettings(self, config_property=None, |
| 111 override_data=None): | 120 override_data=None): |
| 112 """Sets up Findit's config for unit tests. | 121 """Sets up Findit's config for unit tests. |
| 113 | 122 |
| 114 Args: | 123 Args: |
| 115 config_property: The name of the config property to update. | 124 config_property: The name of the config property to update. |
| 116 override_data: A dict to override any default settings. | 125 override_data: A dict to override any default settings. |
| 117 """ | 126 """ |
| 118 config_data = DEFAULT_CONFIG_DATA | 127 config_data = DEFAULT_CONFIG_DATA |
| 119 | 128 |
| 120 if config_property and override_data: | 129 if config_property and override_data: |
| 121 config_data = copy.deepcopy(DEFAULT_CONFIG_DATA) | 130 config_data = copy.deepcopy(DEFAULT_CONFIG_DATA) |
| 122 config_data[config_property].update(override_data) | 131 config_data[config_property].update(override_data) |
| 123 | 132 |
| 124 FinditConfig.Get().Update(users.User(email='admin@chromium.org'), True, | 133 FinditConfig.Get().Update(users.User(email='admin@chromium.org'), True, |
| 125 **config_data) | 134 **config_data) |
| 126 | 135 |
| 127 def setUp(self): | 136 def setUp(self): |
| 128 super(WaterfallTestCase, self).setUp() | 137 super(WaterfallTestCase, self).setUp() |
| 129 self.UpdateUnitTestConfigSettings() | 138 self.UpdateUnitTestConfigSettings() |
| 130 | |
| 131 | |
| OLD | NEW |