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

Side by Side Diff: appengine/findit/handlers/flake/test/check_flake_test.py

Issue 2536953002: [Findit] Add link to swarming tasks. (Closed)
Patch Set: . Created 4 years 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 import datetime 5 import datetime
6 import mock 6 import mock
7 import re 7 import re
8 8
9 import webapp2 9 import webapp2
10 import webtest 10 import webtest
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 build_number = '123' 77 build_number = '123'
78 step_name = 's' 78 step_name = 's'
79 test_name = 't' 79 test_name = 't'
80 success_rate = .9 80 success_rate = .9
81 81
82 analysis = MasterFlakeAnalysis.Create( 82 analysis = MasterFlakeAnalysis.Create(
83 master_name, builder_name, build_number, step_name, test_name) 83 master_name, builder_name, build_number, step_name, test_name)
84 data_point = DataPoint() 84 data_point = DataPoint()
85 data_point.build_number = int(build_number) 85 data_point.build_number = int(build_number)
86 data_point.pass_rate = success_rate 86 data_point.pass_rate = success_rate
87 data_point.task_id = '1'
87 analysis.data_points.append(data_point) 88 analysis.data_points.append(data_point)
88 analysis.status = analysis_status.COMPLETED 89 analysis.status = analysis_status.COMPLETED
89 analysis.suspected_flake_build_number = 100 90 analysis.suspected_flake_build_number = 100
90 analysis.request_time = datetime.datetime(2016, 10, 01, 12, 10, 00) 91 analysis.request_time = datetime.datetime(2016, 10, 01, 12, 10, 00)
91 analysis.start_time = datetime.datetime(2016, 10, 01, 12, 10, 05) 92 analysis.start_time = datetime.datetime(2016, 10, 01, 12, 10, 05)
92 analysis.end_time = datetime.datetime(2016, 10, 01, 13, 10, 00) 93 analysis.end_time = datetime.datetime(2016, 10, 01, 13, 10, 00)
93 analysis.algorithm_parameters = {'iterations_to_rerun': 100} 94 analysis.algorithm_parameters = {'iterations_to_rerun': 100}
94 analysis.Save() 95 analysis.Save()
95 96
96 response = self.test_app.get('/waterfall/check-flake', params={ 97 response = self.test_app.get('/waterfall/check-flake', params={
97 'key': analysis.key.urlsafe(), 98 'key': analysis.key.urlsafe(),
98 'format': 'json'}) 99 'format': 'json'})
99 100
101 task_url = '%s/task?id=%s' % (
102 check_flake.SWARMING_TASK_BASE_URL, data_point.task_id)
100 expected_check_flake_result = { 103 expected_check_flake_result = {
101 'pass_rates': [[int(build_number), success_rate]], 104 'pass_rates': [[int(build_number), success_rate, task_url]],
102 'analysis_status': STATUS_TO_DESCRIPTION.get(analysis.status), 105 'analysis_status': STATUS_TO_DESCRIPTION.get(analysis.status),
103 'master_name': master_name, 106 'master_name': master_name,
104 'builder_name': builder_name, 107 'builder_name': builder_name,
105 'build_number': int(build_number), 108 'build_number': int(build_number),
106 'step_name': step_name, 109 'step_name': step_name,
107 'test_name': test_name, 110 'test_name': test_name,
108 'request_time': '2016-10-01 12:10:00 UTC', 111 'request_time': '2016-10-01 12:10:00 UTC',
109 'task_number': 1, 112 'task_number': 1,
110 'error': None, 113 'error': None,
111 'iterations_to_rerun': 100, 114 'iterations_to_rerun': 100,
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 182
180 response = self.test_app.get('/waterfall/check-flake', params={ 183 response = self.test_app.get('/waterfall/check-flake', params={
181 'master_name': master_name, 184 'master_name': master_name,
182 'builder_name': builder_name, 185 'builder_name': builder_name,
183 'build_number': build_number, 186 'build_number': build_number,
184 'step_name': step_name, 187 'step_name': step_name,
185 'test_name': test_name, 188 'test_name': test_name,
186 'format': 'json'}) 189 'format': 'json'})
187 190
188 expected_check_flake_result = { 191 expected_check_flake_result = {
189 'pass_rates': [[build_number - 1, success_rate]], 192 'pass_rates': [[build_number - 1, success_rate, None]],
190 'analysis_status': STATUS_TO_DESCRIPTION.get(previous_analysis.status), 193 'analysis_status': STATUS_TO_DESCRIPTION.get(previous_analysis.status),
191 'master_name': master_name, 194 'master_name': master_name,
192 'builder_name': builder_name, 195 'builder_name': builder_name,
193 'build_number': build_number - 1, 196 'build_number': build_number - 1,
194 'step_name': step_name, 197 'step_name': step_name,
195 'test_name': test_name, 198 'test_name': test_name,
196 'request_time': '2016-10-01 12:10:00 UTC', 199 'request_time': '2016-10-01 12:10:00 UTC',
197 'task_number': 1, 200 'task_number': 1,
198 'error': None, 201 'error': None,
199 'iterations_to_rerun': 100, 202 'iterations_to_rerun': 100,
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 'm', 'b', '1', None, 't', '').get('data', {}).get('error_message'), 304 'm', 'b', '1', None, 't', '').get('data', {}).get('error_message'),
302 'Step name must be specified') 305 'Step name must be specified')
303 self.assertEqual( 306 self.assertEqual(
304 CheckFlake()._ValidateInput( 307 CheckFlake()._ValidateInput(
305 'm', 'b', '1', 's', None, '').get('data', {}).get('error_message'), 308 'm', 'b', '1', 's', None, '').get('data', {}).get('error_message'),
306 'Test name must be specified') 309 'Test name must be specified')
307 self.assertEqual( 310 self.assertEqual(
308 CheckFlake()._ValidateInput( 311 CheckFlake()._ValidateInput(
309 'm', 'b', '1', 's', 't', 'a').get('data', {}).get('error_message'), 312 'm', 'b', '1', 's', 't', 'a').get('data', {}).get('error_message'),
310 'Bug id (optional) must be an int') 313 'Bug id (optional) must be an int')
OLDNEW
« no previous file with comments | « appengine/findit/handlers/flake/check_flake.py ('k') | appengine/findit/model/flake/master_flake_analysis.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698