| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 os | 5 import os |
| 6 import re | 6 import re |
| 7 | 7 |
| 8 from google.appengine.ext import testbed | 8 from google.appengine.ext import testbed |
| 9 | 9 |
| 10 import webapp2 | 10 import webapp2 |
| (...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 685 expected_data = { | 685 expected_data = { |
| 686 'first_failure': 122, | 686 'first_failure': 122, |
| 687 'last_pass': 121, | 687 'last_pass': 121, |
| 688 'suspected_cls_by_heuristic': [], | 688 'suspected_cls_by_heuristic': [], |
| 689 } | 689 } |
| 690 | 690 |
| 691 data = {} | 691 data = {} |
| 692 build_failure.BuildFailure._PopulateHeuristicDataForCompileFailure( | 692 build_failure.BuildFailure._PopulateHeuristicDataForCompileFailure( |
| 693 analysis, data) | 693 analysis, data) |
| 694 self.assertEqual(expected_data, data) | 694 self.assertEqual(expected_data, data) |
| 695 |
| 696 def testGetTryJobResultForCompileFailure(self): |
| 697 analysis = WfAnalysis.Create('m', 'b', 123) |
| 698 analysis.result = { |
| 699 'failures': [ |
| 700 { |
| 701 'step_name': 'compile', |
| 702 'first_failure': 122, |
| 703 'last_pass': 121, |
| 704 'suspected_cls': [], |
| 705 }, |
| 706 { |
| 707 'step_name': 'steps', |
| 708 }, |
| 709 ] |
| 710 } |
| 711 analysis.failure_result_map = { |
| 712 'compile': 'm/b/122', |
| 713 } |
| 714 analysis.status = analysis_status.COMPLETED |
| 715 analysis.put() |
| 716 |
| 717 try_job = WfTryJob.Create('m', 'b', 122) |
| 718 try_job.status = analysis_status.COMPLETED |
| 719 try_job.compile_results = [ |
| 720 { |
| 721 'url': 'build/url', |
| 722 'culprit': { |
| 723 'compile': { |
| 724 'revision': 'rev', |
| 725 } |
| 726 } |
| 727 } |
| 728 ] |
| 729 try_job.put() |
| 730 |
| 731 expected_try_job_result = { |
| 732 'status': 'completed', |
| 733 'url': 'build/url', |
| 734 'completed': True, |
| 735 'culprit': { |
| 736 'revision': 'rev', |
| 737 }, |
| 738 'failed': False, |
| 739 } |
| 740 |
| 741 build_url = buildbot.CreateBuildUrl('m', 'b', 123) |
| 742 response = self.test_app.get('/build-failure', |
| 743 params={'url': build_url, 'format': 'json'}) |
| 744 |
| 745 self.assertEquals(200, response.status_int) |
| 746 self.assertEqual(expected_try_job_result, response.json_body['try_job']) |
| OLD | NEW |