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

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

Issue 2026283002: [Findit] Adding logic to force try jobs regardless of bailout or previous results (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Addressing comments and rebase Created 4 years, 5 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
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 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 'try_job_key': 'm/b/119', 543 'try_job_key': 'm/b/119',
544 'status': result_status.NO_TRY_JOB_REASON_MAP.get( 544 'status': result_status.NO_TRY_JOB_REASON_MAP.get(
545 result_status.NON_SWARMING_NO_RERUN), 545 result_status.NON_SWARMING_NO_RERUN),
546 'tests': ['test1'] 546 'tests': ['test1']
547 } 547 }
548 ] 548 ]
549 } 549 }
550 } 550 }
551 self.assertEqual(expected_result, result) 551 self.assertEqual(expected_result, result)
552 552
553 def testGetAllTryJobResultsForTestNonSwarmingForcedTryJob(self):
554 tasks_info = {
555 'step1': {
556 'swarming_tasks': {
557 'm/b/119': {
558 'task_info': {
559 'status': result_status.NON_SWARMING_NO_RERUN
560 },
561 'all_tests': ['test1']
562 },
563 }
564 }
565 }
566 result = handlers_util._GetAllTryJobResultsForTest(
567 {'step1': 'm/b/119'}, tasks_info, True)
568
569 expected_result = {
570 'step1': {
571 'try_jobs': [
572 {
573 'try_job_key': 'm/b/119',
574 'ref_name': 'step1'
575 }
576 ]
577 }
578 }
579
580 self.assertEqual(expected_result, result)
581
553 def testGetAllTryJobResultsForTestNoSwarmingTaskInfo(self): 582 def testGetAllTryJobResultsForTestNoSwarmingTaskInfo(self):
554 failure_result_map = { 583 failure_result_map = {
555 'step1': { 584 'step1': {
556 'test3': 'm/b/119' 585 'test3': 'm/b/119'
557 } 586 }
558 } 587 }
559 588
560 tasks_info = {} 589 tasks_info = {}
561 590
562 result = handlers_util._GetAllTryJobResultsForTest( 591 result = handlers_util._GetAllTryJobResultsForTest(
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
916 { 945 {
917 'ref_name': 'step1', 946 'ref_name': 'step1',
918 'try_job_key': try_job_key, 947 'try_job_key': try_job_key,
919 'tests': ['test2', 'test3'] 948 'tests': ['test2', 'test3']
920 } 949 }
921 ] 950 ]
922 } 951 }
923 } 952 }
924 WfTryJob.Create('m', 'b', '119').put() 953 WfTryJob.Create('m', 'b', '119').put()
925 handlers_util._GetCulpritInfoForTryJobResultForTest( 954 handlers_util._GetCulpritInfoForTryJobResultForTest(
926 try_job_key, culprits_info) 955 try_job_key, culprits_info, False)
927 956
928 expected_culprits_info = { 957 expected_culprits_info = {
929 'step1 on platform': { 958 'step1 on platform': {
930 'try_jobs': [ 959 'try_jobs': [
931 { 960 {
932 'ref_name': 'step1', 961 'ref_name': 'step1',
933 'try_job_key': try_job_key, 962 'try_job_key': try_job_key,
934 'tests': ['test2', 'test3'], 963 'tests': ['test2', 'test3'],
935 'status': analysis_status.PENDING 964 'status': analysis_status.PENDING
936 } 965 }
(...skipping 19 matching lines...) Expand all
956 try_job.status = analysis_status.RUNNING 985 try_job.status = analysis_status.RUNNING
957 try_job.test_results = [ 986 try_job.test_results = [
958 { 987 {
959 'url': ('http://build.chromium.org/p/tryserver.chromium.' 988 'url': ('http://build.chromium.org/p/tryserver.chromium.'
960 'linux/builders/linux_chromium_variable/builds/121'), 989 'linux/builders/linux_chromium_variable/builds/121'),
961 'try_job_id': '121' 990 'try_job_id': '121'
962 } 991 }
963 ] 992 ]
964 try_job.put() 993 try_job.put()
965 handlers_util._GetCulpritInfoForTryJobResultForTest( 994 handlers_util._GetCulpritInfoForTryJobResultForTest(
966 try_job_key, culprits_info) 995 try_job_key, culprits_info, False)
967 996
968 expected_culprits_info = { 997 expected_culprits_info = {
969 'step1 on platform': { 998 'step1 on platform': {
970 'try_jobs': [ 999 'try_jobs': [
971 { 1000 {
972 'ref_name': 'step1', 1001 'ref_name': 'step1',
973 'try_job_key': try_job_key, 1002 'try_job_key': try_job_key,
974 'tests': ['test2', 'test3'], 1003 'tests': ['test2', 'test3'],
975 'status': analysis_status.RUNNING, 1004 'status': analysis_status.RUNNING,
976 'try_job_url': ( 1005 'try_job_url': (
977 'http://build.chromium.org/p/tryserver.chromium.' 1006 'http://build.chromium.org/p/tryserver.chromium.'
978 'linux/builders/linux_chromium_variable/builds/121'), 1007 'linux/builders/linux_chromium_variable/builds/121'),
979 'try_job_build_number': 121 1008 'try_job_build_number': 121
980 } 1009 }
981 ] 1010 ]
982 } 1011 }
983 } 1012 }
984 self.assertEqual(expected_culprits_info, culprits_info) 1013 self.assertEqual(expected_culprits_info, culprits_info)
OLDNEW
« no previous file with comments | « appengine/findit/handlers/test/build_failure_test.py ('k') | appengine/findit/templates/build_failure.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698