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

Side by Side Diff: appengine/findit/handlers/test/handlers_util_test.py

Issue 2027333002: [Findit] don't included skipped or unknown tests in swarming tasks into failed tests. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: . Created 4 years, 6 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 handlers import handlers_util 5 from handlers import handlers_util
6 from handlers import result_status 6 from handlers import result_status
7 from model import analysis_status 7 from model import analysis_status
8 from model.wf_analysis import WfAnalysis 8 from model.wf_analysis import WfAnalysis
9 from model.wf_swarming_task import WfSwarmingTask 9 from model.wf_swarming_task import WfSwarmingTask
10 from model.wf_try_job import WfTryJob 10 from model.wf_try_job import WfTryJob
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 } 127 }
128 } 128 }
129 } 129 }
130 self.assertEqual(expected_data, data) 130 self.assertEqual(expected_data, data)
131 131
132 def testGetSwarmingTaskInfo(self): 132 def testGetSwarmingTaskInfo(self):
133 analysis = WfAnalysis.Create( 133 analysis = WfAnalysis.Create(
134 self.master_name, self.builder_name, self.build_number) 134 self.master_name, self.builder_name, self.build_number)
135 analysis.failure_result_map = { 135 analysis.failure_result_map = {
136 'step1 on platform': { 136 'step1 on platform': {
137 'test1': '%s/%s/%s' % (self.master_name, self.builder_name, 120), 137 'PRE_test1': '%s/%s/%s' % (
138 'test2': '%s/%s/%s' % ( 138 self.master_name, self.builder_name, 120),
139 'PRE_PRE_test2': '%s/%s/%s' % (
139 self.master_name, self.builder_name, self.build_number), 140 self.master_name, self.builder_name, self.build_number),
140 'test3': '%s/%s/%s' % ( 141 'test3': '%s/%s/%s' % (
141 self.master_name, self.builder_name, self.build_number), 142 self.master_name, self.builder_name, self.build_number),
142 'test4': '%s/%s/%s' % ( 143 'test4': '%s/%s/%s' % (
143 self.master_name, self.builder_name, self.build_number) 144 self.master_name, self.builder_name, self.build_number)
144 }, 145 },
145 'step2': { 146 'step2': {
146 'test1': '%s/%s/%s' % ( 147 'test1': '%s/%s/%s' % (
147 self.master_name, self.builder_name, self.build_number) 148 self.master_name, self.builder_name, self.build_number)
148 } 149 }
149 } 150 }
150 analysis.put() 151 analysis.put()
151 152
152 task0 = WfSwarmingTask.Create( 153 task0 = WfSwarmingTask.Create(
153 self.master_name, self.builder_name, 120, 'step1 on platform') 154 self.master_name, self.builder_name, 120, 'step1 on platform')
154 task0.task_id = 'task0' 155 task0.task_id = 'task0'
155 task0.status = analysis_status.COMPLETED 156 task0.status = analysis_status.COMPLETED
156 task0.parameters = { 157 task0.parameters = {
157 'tests': ['test1'] 158 'tests': ['test1']
158 } 159 }
159 task0.tests_statuses = { 160 task0.tests_statuses = {
160 'test1': { 161 'test1': {
161 'total_run': 2, 162 'total_run': 2,
163 'SKIPPED': 2
164 },
165 'PRE_test1': {
166 'total_run': 2,
162 'FAILURE': 2 167 'FAILURE': 2
163 } 168 }
164 } 169 }
165 task0.put() 170 task0.put()
166 171
167 task1 = WfSwarmingTask.Create( 172 task1 = WfSwarmingTask.Create(
168 self.master_name, self.builder_name, self.build_number, 173 self.master_name, self.builder_name, self.build_number,
169 'step1 on platform') 174 'step1 on platform')
170 task1.task_id = 'task1' 175 task1.task_id = 'task1'
171 task1.status = analysis_status.COMPLETED 176 task1.status = analysis_status.COMPLETED
172 task1.parameters = { 177 task1.parameters = {
173 'tests': ['test2', 'test3', 'test4'] 178 'tests': ['test2', 'test3', 'test4']
174 } 179 }
175 task1.tests_statuses = { 180 task1.tests_statuses = {
181 'PRE_PRE_test2': {
182 'total_run': 2,
183 'FAILURE': 2
184 },
185 'PRE_test2': {
186 'total_run': 2,
187 'SKIPPED': 2
188 },
176 'test2': { 189 'test2': {
177 'total_run': 2, 190 'total_run': 2,
178 'FAILURE': 2 191 'SKIPPED': 2
179 }, 192 },
180 'test3': { 193 'test3': {
181 'total_run': 4, 194 'total_run': 4,
182 'SUCCESS': 2, 195 'SUCCESS': 2,
183 'FAILURE': 2 196 'FAILURE': 2
184 }, 197 },
185 'test4': { 198 'test4': {
186 'total_run': 6, 199 'total_run': 6,
187 'SUCCESS': 6 200 'SUCCESS': 6
188 } 201 }
(...skipping 10 matching lines...) Expand all
199 expected_data = { 212 expected_data = {
200 'step1 on platform': { 213 'step1 on platform': {
201 'swarming_tasks': { 214 'swarming_tasks': {
202 'm/b/121': { 215 'm/b/121': {
203 'task_info': { 216 'task_info': {
204 'status': analysis_status.COMPLETED, 217 'status': analysis_status.COMPLETED,
205 'task_id': 'task1', 218 'task_id': 'task1',
206 'task_url': ('https://chromium-swarm.appspot.com/user' 219 'task_url': ('https://chromium-swarm.appspot.com/user'
207 '/task/task1') 220 '/task/task1')
208 }, 221 },
209 'all_tests': ['test2', 'test3', 'test4'], 222 'all_tests': ['PRE_PRE_test2', 'test3', 'test4'],
210 'reliable_tests': ['test2'], 223 'reliable_tests': ['PRE_PRE_test2'],
211 'flaky_tests': ['test3', 'test4'], 224 'flaky_tests': ['test3', 'test4'],
212 'ref_name': 'step1' 225 'ref_name': 'step1'
213 }, 226 },
214 'm/b/120': { 227 'm/b/120': {
215 'task_info': { 228 'task_info': {
216 'status': analysis_status.COMPLETED, 229 'status': analysis_status.COMPLETED,
217 'task_id': 'task0', 230 'task_id': 'task0',
218 'task_url': ('https://chromium-swarm.appspot.com/user/' 231 'task_url': ('https://chromium-swarm.appspot.com/user/'
219 'task/task0') 232 'task/task0')
220 }, 233 },
221 'all_tests': ['test1'], 234 'all_tests': ['PRE_test1'],
222 'reliable_tests': ['test1'], 235 'reliable_tests': ['PRE_test1'],
223 'flaky_tests': [], 236 'flaky_tests': [],
224 'ref_name': 'step1' 237 'ref_name': 'step1'
225 } 238 }
226 } 239 }
227 }, 240 },
228 'step2': { 241 'step2': {
229 'swarming_tasks': { 242 'swarming_tasks': {
230 'm/b/121': { 243 'm/b/121': {
231 'task_info': { 244 'task_info': {
232 'status': analysis_status.PENDING 245 'status': analysis_status.PENDING
233 }, 246 },
234 'all_tests': ['test1'], 247 'all_tests': ['PRE_test1'],
235 'ref_name': 'step2' 248 'ref_name': 'step2'
236 } 249 }
237 } 250 }
238 } 251 }
239 } 252 }
240 self.assertEqual(expected_data, data) 253 self.assertEqual(sorted(expected_data), sorted(data))
241 254
242 def testGetAllTryJobResultsNoAnalysis(self): 255 def testGetAllTryJobResultsNoAnalysis(self):
243 data = handlers_util.GetAllTryJobResults( 256 data = handlers_util.GetAllTryJobResults(
244 self.master_name, self.builder_name, self.build_number) 257 self.master_name, self.builder_name, self.build_number)
245 258
246 self.assertEqual({}, data) 259 self.assertEqual({}, data)
247 260
248 def testGetTryJobResultReturnNoneIfNoFailureResultMap(self): 261 def testGetTryJobResultReturnNoneIfNoFailureResultMap(self):
249 analysis = WfAnalysis.Create( 262 analysis = WfAnalysis.Create(
250 self.master_name, self.builder_name, self.build_number) 263 self.master_name, self.builder_name, self.build_number)
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
962 'status': analysis_status.RUNNING, 975 'status': analysis_status.RUNNING,
963 'try_job_url': ( 976 'try_job_url': (
964 'http://build.chromium.org/p/tryserver.chromium.' 977 'http://build.chromium.org/p/tryserver.chromium.'
965 'linux/builders/linux_chromium_variable/builds/121'), 978 'linux/builders/linux_chromium_variable/builds/121'),
966 'try_job_build_number': 121 979 'try_job_build_number': 121
967 } 980 }
968 ] 981 ]
969 } 982 }
970 } 983 }
971 self.assertEqual(expected_culprits_info, culprits_info) 984 self.assertEqual(expected_culprits_info, culprits_info)
OLDNEW
« no previous file with comments | « appengine/findit/handlers/handlers_util.py ('k') | appengine/findit/model/test/wf_swarming_task_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698