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

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

Issue 2175053002: [Findit] Fixing debug view UI not to bundle unclassified with reliable failures (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Fixing unit tests Created 4 years, 4 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
« no previous file with comments | « appengine/findit/handlers/handlers_util.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 553 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 } 564 }
565 } 565 }
566 result = handlers_util._GetAllTryJobResultsForTest( 566 result = handlers_util._GetAllTryJobResultsForTest(
567 {'step1': 'm/b/119'}, tasks_info, True) 567 {'step1': 'm/b/119'}, tasks_info, True)
568 568
569 expected_result = { 569 expected_result = {
570 'step1': { 570 'step1': {
571 'try_jobs': [ 571 'try_jobs': [
572 { 572 {
573 'try_job_key': 'm/b/119', 573 'try_job_key': 'm/b/119',
574 'ref_name': 'step1' 574 'ref_name': 'step1',
575 'can_force': True,
576 'status': result_status.NON_SWARMING_NO_RERUN,
577 'tests': ['test1']
575 } 578 }
576 ] 579 ]
577 } 580 }
578 } 581 }
579 582
580 self.assertEqual(expected_result, result) 583 self.assertEqual(expected_result, result)
581 584
582 def testGetAllTryJobResultsForTestNoSwarmingTaskInfo(self): 585 def testGetAllTryJobResultsForTestNoSwarmingTaskInfo(self):
583 failure_result_map = { 586 failure_result_map = {
584 'step1': { 587 'step1': {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 'try_job_key': 'm/b/119', 641 'try_job_key': 'm/b/119',
639 'status': result_status.NO_TRY_JOB_REASON_MAP[ 642 'status': result_status.NO_TRY_JOB_REASON_MAP[
640 analysis_status.RUNNING], 643 analysis_status.RUNNING],
641 'task_id': 'task3', 644 'task_id': 'task3',
642 'task_url': 'task3_url', 645 'task_url': 'task3_url',
643 'tests': ['test3'] 646 'tests': ['test3']
644 } 647 }
645 ] 648 ]
646 } 649 }
647 } 650 }
651
648 self.assertEqual(expected_result, result) 652 self.assertEqual(expected_result, result)
649 653
650 def testUpdateTryJobInfoBasedOnSwarmingAllFlaky(self): 654 def testUpdateTryJobInfoBasedOnSwarmingAllFlaky(self):
651 step_tasks_info = { 655 step_tasks_info = {
652 'swarming_tasks': { 656 'swarming_tasks': {
653 'm/b/119': { 657 'm/b/119': {
654 'task_info': { 658 'task_info': {
655 'status': analysis_status.COMPLETED, 659 'status': analysis_status.COMPLETED,
656 'task_id': 'task1', 660 'task_id': 'task1',
657 'task_url': 'task_url' 661 'task_url': 'task_url'
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
945 { 949 {
946 'ref_name': 'step1', 950 'ref_name': 'step1',
947 'try_job_key': try_job_key, 951 'try_job_key': try_job_key,
948 'tests': ['test2', 'test3'] 952 'tests': ['test2', 'test3']
949 } 953 }
950 ] 954 ]
951 } 955 }
952 } 956 }
953 WfTryJob.Create('m', 'b', '119').put() 957 WfTryJob.Create('m', 'b', '119').put()
954 handlers_util._GetCulpritInfoForTryJobResultForTest( 958 handlers_util._GetCulpritInfoForTryJobResultForTest(
955 try_job_key, culprits_info, False) 959 try_job_key, culprits_info)
956 960
957 expected_culprits_info = { 961 expected_culprits_info = {
958 'step1 on platform': { 962 'step1 on platform': {
959 'try_jobs': [ 963 'try_jobs': [
960 { 964 {
961 'ref_name': 'step1', 965 'ref_name': 'step1',
962 'try_job_key': try_job_key, 966 'try_job_key': try_job_key,
963 'tests': ['test2', 'test3'], 967 'tests': ['test2', 'test3'],
964 'status': analysis_status.PENDING 968 'status': analysis_status.PENDING
965 } 969 }
(...skipping 19 matching lines...) Expand all
985 try_job.status = analysis_status.RUNNING 989 try_job.status = analysis_status.RUNNING
986 try_job.test_results = [ 990 try_job.test_results = [
987 { 991 {
988 'url': ('http://build.chromium.org/p/tryserver.chromium.' 992 'url': ('http://build.chromium.org/p/tryserver.chromium.'
989 'linux/builders/linux_chromium_variable/builds/121'), 993 'linux/builders/linux_chromium_variable/builds/121'),
990 'try_job_id': '121' 994 'try_job_id': '121'
991 } 995 }
992 ] 996 ]
993 try_job.put() 997 try_job.put()
994 handlers_util._GetCulpritInfoForTryJobResultForTest( 998 handlers_util._GetCulpritInfoForTryJobResultForTest(
995 try_job_key, culprits_info, False) 999 try_job_key, culprits_info)
996 1000
997 expected_culprits_info = { 1001 expected_culprits_info = {
998 'step1 on platform': { 1002 'step1 on platform': {
999 'try_jobs': [ 1003 'try_jobs': [
1000 { 1004 {
1001 'ref_name': 'step1', 1005 'ref_name': 'step1',
1002 'try_job_key': try_job_key, 1006 'try_job_key': try_job_key,
1003 'tests': ['test2', 'test3'], 1007 'tests': ['test2', 'test3'],
1004 'status': analysis_status.RUNNING, 1008 'status': analysis_status.RUNNING,
1005 'try_job_url': ( 1009 'try_job_url': (
1006 'http://build.chromium.org/p/tryserver.chromium.' 1010 'http://build.chromium.org/p/tryserver.chromium.'
1007 'linux/builders/linux_chromium_variable/builds/121'), 1011 'linux/builders/linux_chromium_variable/builds/121'),
1008 'try_job_build_number': 121 1012 'try_job_build_number': 121
1009 } 1013 }
1010 ] 1014 ]
1011 } 1015 }
1012 } 1016 }
1013 self.assertEqual(expected_culprits_info, culprits_info) 1017 self.assertEqual(expected_culprits_info, culprits_info)
OLDNEW
« no previous file with comments | « appengine/findit/handlers/handlers_util.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698