Chromium Code Reviews| Index: dashboard/dashboard/bisect_fyi.py |
| diff --git a/dashboard/dashboard/bisect_fyi.py b/dashboard/dashboard/bisect_fyi.py |
| index 822031bbf98d7ede84b9c8c27f5a33a061bda116..38e201d945df2bbd3ea3e750f3b2838710b07ba0 100644 |
| --- a/dashboard/dashboard/bisect_fyi.py |
| +++ b/dashboard/dashboard/bisect_fyi.py |
| @@ -5,7 +5,6 @@ |
| """URL endpoint for a cron job to run bisects integration tests.""" |
| import datetime |
| -import logging |
| import time |
| from google.appengine.api import mail |
| @@ -114,53 +113,39 @@ def _MakeBisectFYITryJob(test_name, bisect_config): |
| return bisect_job |
| -def VerifyBisectFYIResults(job, bisect_results): |
| - """Verifies the bisect results against expected results in test config.""" |
| +def VerifyBisectFYIResults(job): |
| + """Verifies the bisect results against expected results in test config. |
| + |
| + Args: |
| + job: TryJob entity. |
| + |
| + Returns: |
| + A message with the missing properties, otherwise returns an empty string. |
| + """ |
| bisect_fyi_configs = stored_object.Get(_BISECT_FYI_CONFIGS_KEY) |
| for test_name, config in bisect_fyi_configs.iteritems(): |
| - if job.job_name == test_name: |
| - errors = _VerifyExpectedResults( |
| - bisect_results.get('results'), config.get('expected_results')) |
| - if errors: |
| - bisect_results['status'] = 'Failure' |
| - bisect_results['errors'] = errors |
| - return bisect_results |
| + if job.job_name == test_name and config: |
| + expected = set(config.keys()) |
|
prasadv
2016/02/09 21:09:41
Here we actually want to compare the values for th
chrisphan
2016/02/09 22:10:40
For a second I forgot why I'm doing this.
So we b
|
| + actual = set(job.results_data.keys()) |
| + missing = expected - actual |
| + if missing: |
| + return ('Bisect result is missing the following expected properties:' |
| + '%s.\n' % ','.join(missing)) |
| + return '' |
| -def VerifyBugUpdate(job, issue_tracker, bisect_results): |
| +def IsBugUpdated(job, issue_tracker): |
| """Verifies whether bug is updated with the bisect results.""" |
| comment_info = issue_tracker.GetLastBugCommentsAndTimestamp(job.bug_id) |
| - err_msg = 'Failed to update bug %s with bisect results.' % job.bug_id |
| if not comment_info: |
| - bisect_results['status'] = 'Failure' |
| - if bisect_results.get('errors'): |
| - err_msg = '%s\n%s' % (bisect_results['errors'], err_msg) |
| - bisect_results['errors'] = err_msg |
| - return bisect_results |
| + return False |
| bug_update_timestamp = datetime.datetime.strptime( |
| comment_info['timestamp'], '%Y-%m-%dT%H:%M:%S.%fZ') |
| try_job_timestamp = time.mktime(job.last_ran_timestamp.timetuple()) |
| if bug_update_timestamp <= try_job_timestamp: |
| - logging.info('Issue updated timestamp: %s', bug_update_timestamp) |
| - logging.info('Try job timestamp: %s', try_job_timestamp) |
| - bisect_results['status'] = 'Failure' |
| - if bisect_results.get('errors'): |
| - err_msg = '%s\n%s' % (bisect_results['errors'], err_msg) |
| - bisect_results['errors'] = err_msg |
| - return bisect_results |
| - |
| - |
| -def _VerifyExpectedResults(bisect_results, expected_results): |
| - if not expected_results: |
| - return 'No expected results found in test config.' |
| - error_list = [] |
| - for key, value in expected_results.iteritems(): |
| - if value not in bisect_results: |
| - error_list.append('Expected results %s = "%s" not found in bisect ' |
| - 'results.\n' % (key, value)) |
| - |
| - return ''.join(error_list) |
| + return False |
| + return True |
| def _TextBody(errors_list): |