| 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 import copy | 4 import copy |
| 5 import json | 5 import json |
| 6 import logging | 6 import logging |
| 7 | 7 |
| 8 from google.appengine.api import app_identity | 8 from google.appengine.api import app_identity |
| 9 from google.appengine.ext import ndb | 9 from google.appengine.ext import ndb |
| 10 from webtest.app import AppError | 10 from webtest.app import AppError |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 analysis.status = analysis_status.RUNNING | 71 analysis.status = analysis_status.RUNNING |
| 72 analysis.put() | 72 analysis.put() |
| 73 | 73 |
| 74 pipeline = crash_pipeline.CrashAnalysisPipeline( | 74 pipeline = crash_pipeline.CrashAnalysisPipeline( |
| 75 CrashClient.FRACAS, | 75 CrashClient.FRACAS, |
| 76 crash_identifiers) | 76 crash_identifiers) |
| 77 pipeline._PutAbortedError() | 77 pipeline._PutAbortedError() |
| 78 analysis = FracasCrashAnalysis.Get(crash_identifiers) | 78 analysis = FracasCrashAnalysis.Get(crash_identifiers) |
| 79 self.assertEqual(analysis_status.ERROR, analysis.status) | 79 self.assertEqual(analysis_status.ERROR, analysis.status) |
| 80 | 80 |
| 81 def testFindCulpritFails(self): |
| 82 crash_identifiers = DummyCrashData()['crash_identifiers'] |
| 83 analysis = FracasCrashAnalysis.Create(crash_identifiers) |
| 84 analysis.status = analysis_status.RUNNING |
| 85 analysis.put() |
| 86 |
| 87 self.mock(FinditForFracas, 'FindCulprit', lambda *_: None) |
| 88 pipeline = crash_pipeline.CrashAnalysisPipeline( |
| 89 CrashClient.FRACAS, |
| 90 crash_identifiers) |
| 91 pipeline.run() |
| 92 |
| 93 analysis = FracasCrashAnalysis.Get(crash_identifiers) |
| 94 self.assertEqual(analysis_status.COMPLETED, analysis.status) |
| 95 self.assertFalse(analysis.result['found']) |
| 96 self.assertFalse(analysis.found_suspects) |
| 97 self.assertFalse(analysis.found_project) |
| 98 self.assertFalse(analysis.found_components) |
| 81 | 99 |
| 82 # TODO: this function is a gross hack. We should figure out what the | 100 # TODO: this function is a gross hack. We should figure out what the |
| 83 # semantic goal really is here, so we can avoid doing such intricate | 101 # semantic goal really is here, so we can avoid doing such intricate |
| 84 # and fragile mocking. | 102 # and fragile mocking. |
| 85 def _TestRunningAnalysisForResult(self, analysis_result, analysis_tags): | 103 def _TestRunningAnalysisForResult(self, analysis_result, analysis_tags): |
| 86 | 104 |
| 87 # Mock out the part of PublishResultPipeline that would go over the wire. | 105 # Mock out the part of PublishResultPipeline that would go over the wire. |
| 88 pubsub_publish_requests = [] | 106 pubsub_publish_requests = [] |
| 89 def Mocked_PublishMessagesToTopic(messages_data, topic): | 107 def Mocked_PublishMessagesToTopic(messages_data, topic): |
| 90 pubsub_publish_requests.append((messages_data, topic)) | 108 pubsub_publish_requests.append((messages_data, topic)) |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 'has_regression_range': True, | 261 'has_regression_range': True, |
| 244 'solution': 'core', | 262 'solution': 'core', |
| 245 'unsupported_tag': '', | 263 'unsupported_tag': '', |
| 246 } | 264 } |
| 247 | 265 |
| 248 analysis = self._TestRunningAnalysisForResult( | 266 analysis = self._TestRunningAnalysisForResult( |
| 249 analysis_result, analysis_tags) | 267 analysis_result, analysis_tags) |
| 250 self.assertTrue(analysis.has_regression_range) | 268 self.assertTrue(analysis.has_regression_range) |
| 251 self.assertTrue(analysis.found_suspects) | 269 self.assertTrue(analysis.found_suspects) |
| 252 self.assertEqual('core', analysis.solution) | 270 self.assertEqual('core', analysis.solution) |
| OLD | NEW |