Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: appengine/findit/waterfall/test/wf_testcase.py

Issue 2272953002: [Findit] Moving check flake parameters to config (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Updating swarming settings config example Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 81
82 82
83 _DEFAULT_SWARMING_SETTINGS = { 83 _DEFAULT_SWARMING_SETTINGS = {
84 'server_host': 'chromium-swarm.appspot.com', 84 'server_host': 'chromium-swarm.appspot.com',
85 'default_request_priority': 150, 85 'default_request_priority': 150,
86 'request_expiration_hours': 20, 86 'request_expiration_hours': 20,
87 'server_query_interval_seconds': 60, 87 'server_query_interval_seconds': 60,
88 'task_timeout_hours': 23, 88 'task_timeout_hours': 23,
89 'isolated_server': 'https://isolateserver.appspot.com', 89 'isolated_server': 'https://isolateserver.appspot.com',
90 'isolated_storage_url': 'isolateserver.storage.googleapis.com', 90 'isolated_storage_url': 'isolateserver.storage.googleapis.com',
91 'iterations_to_rerun': 10 91 'iterations_to_rerun': 10,
92 'get_swarming_task_id_timeout_seconds': 5 * 60, # 5 minutes.
93 'get_swarming_task_id_wait_seconds': 10,
92 } 94 }
93 95
94 96
95 _DEFAULT_DOWNLOAD_BUILD_DATA_SETTINGS = { 97 _DEFAULT_DOWNLOAD_BUILD_DATA_SETTINGS = {
96 'download_interval_seconds': 10, 98 'download_interval_seconds': 10,
97 'memcache_master_download_expiration_seconds': 3600, 99 'memcache_master_download_expiration_seconds': 3600,
98 'use_chrome_build_extract': True 100 'use_chrome_build_extract': True
99 } 101 }
100 102
101 103
102 _DEFAULT_ACTION_SETTINGS = { 104 _DEFAULT_ACTION_SETTINGS = {
103 'cr_notification_build_threshold': 2, 105 'cr_notification_build_threshold': 2,
104 'cr_notification_latency_limit_minutes': 30, 106 'cr_notification_latency_limit_minutes': 30,
105 } 107 }
106 108
107 109
110 _DEFAULT_CHECK_FLAKE_SETTINGS = {
111 'lower_flake_threshold': 0.02,
112 'upper_flake_threshold': 0.98,
113 'max_flake_in_a_row': 4,
114 'max_stable_in_a_row': 4,
115 'iterations_to_rerun': 100
116 }
117
118
108 DEFAULT_CONFIG_DATA = { 119 DEFAULT_CONFIG_DATA = {
109 'steps_for_masters_rules': _DEFAULT_STEPS_FOR_MASTERS_RULES, 120 'steps_for_masters_rules': _DEFAULT_STEPS_FOR_MASTERS_RULES,
110 'builders_to_trybots': _DEFAULT_TRY_BOT_MAPPING, 121 'builders_to_trybots': _DEFAULT_TRY_BOT_MAPPING,
111 'try_job_settings': _DEFAULT_TRY_JOB_SETTINGS, 122 'try_job_settings': _DEFAULT_TRY_JOB_SETTINGS,
112 'swarming_settings': _DEFAULT_SWARMING_SETTINGS, 123 'swarming_settings': _DEFAULT_SWARMING_SETTINGS,
113 'download_build_data_settings': _DEFAULT_DOWNLOAD_BUILD_DATA_SETTINGS, 124 'download_build_data_settings': _DEFAULT_DOWNLOAD_BUILD_DATA_SETTINGS,
114 'action_settings': _DEFAULT_ACTION_SETTINGS, 125 'action_settings': _DEFAULT_ACTION_SETTINGS,
126 'check_flake_settings': _DEFAULT_CHECK_FLAKE_SETTINGS
115 } 127 }
116 128
117 129
118 class WaterfallTestCase(FinditTestCase): # pragma: no cover. 130 class WaterfallTestCase(FinditTestCase): # pragma: no cover.
119 131
120 def UpdateUnitTestConfigSettings(self, config_property=None, 132 def UpdateUnitTestConfigSettings(self, config_property=None,
121 override_data=None): 133 override_data=None):
122 """Sets up Findit's config for unit tests. 134 """Sets up Findit's config for unit tests.
123 135
124 Args: 136 Args:
125 config_property: The name of the config property to update. 137 config_property: The name of the config property to update.
126 override_data: A dict to override any default settings. 138 override_data: A dict to override any default settings.
127 """ 139 """
128 config_data = DEFAULT_CONFIG_DATA 140 config_data = DEFAULT_CONFIG_DATA
129 141
130 if config_property and override_data: 142 if config_property and override_data:
131 config_data = copy.deepcopy(DEFAULT_CONFIG_DATA) 143 config_data = copy.deepcopy(DEFAULT_CONFIG_DATA)
132 config_data[config_property].update(override_data) 144 config_data[config_property].update(override_data)
133 145
134 FinditConfig.Get().Update(users.User(email='admin@chromium.org'), True, 146 FinditConfig.Get().Update(users.User(email='admin@chromium.org'), True,
135 **config_data) 147 **config_data)
136 148
137 def setUp(self): 149 def setUp(self):
138 super(WaterfallTestCase, self).setUp() 150 super(WaterfallTestCase, self).setUp()
139 self.UpdateUnitTestConfigSettings() 151 self.UpdateUnitTestConfigSettings()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698