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

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: Created 4 years, 6 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 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 'try_job_key': 'm/b/119', 530 'try_job_key': 'm/b/119',
531 'status': result_status.NO_TRY_JOB_REASON_MAP.get( 531 'status': result_status.NO_TRY_JOB_REASON_MAP.get(
532 result_status.NON_SWARMING_NO_RERUN), 532 result_status.NON_SWARMING_NO_RERUN),
533 'tests': ['test1'] 533 'tests': ['test1']
534 } 534 }
535 ] 535 ]
536 } 536 }
537 } 537 }
538 self.assertEqual(expected_result, result) 538 self.assertEqual(expected_result, result)
539 539
540 def testGetAllTryJobResultsForTestNonSwarmingForcedTryJob(self):
541 tasks_info = {
542 'step1': {
543 'swarming_tasks': {
544 'm/b/119': {
545 'task_info': {
546 'status': result_status.NON_SWARMING_NO_RERUN
547 },
548 'all_tests': ['test1']
549 },
550 }
551 }
552 }
553 result = handlers_util._GetAllTryJobResultsForTest(
554 {'step1': 'm/b/119'}, tasks_info, True)
555
556 expected_result = {
557 'step1': {
558 'try_jobs': [
559 {
560 'try_job_key': 'm/b/119',
561 'ref_name': None
562 }
563 ]
564 }
565 }
566 self.assertEqual(expected_result, result)
567
540 def testGetAllTryJobResultsForTestNoSwarmingTaskInfo(self): 568 def testGetAllTryJobResultsForTestNoSwarmingTaskInfo(self):
541 failure_result_map = { 569 failure_result_map = {
542 'step1': { 570 'step1': {
543 'test3': 'm/b/119' 571 'test3': 'm/b/119'
544 } 572 }
545 } 573 }
546 574
547 tasks_info = {} 575 tasks_info = {}
548 576
549 result = handlers_util._GetAllTryJobResultsForTest( 577 result = handlers_util._GetAllTryJobResultsForTest(
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 { 931 {
904 'ref_name': 'step1', 932 'ref_name': 'step1',
905 'try_job_key': try_job_key, 933 'try_job_key': try_job_key,
906 'tests': ['test2', 'test3'] 934 'tests': ['test2', 'test3']
907 } 935 }
908 ] 936 ]
909 } 937 }
910 } 938 }
911 WfTryJob.Create('m', 'b', '119').put() 939 WfTryJob.Create('m', 'b', '119').put()
912 handlers_util._GetCulpritInfoForTryJobResultForTest( 940 handlers_util._GetCulpritInfoForTryJobResultForTest(
913 try_job_key, culprits_info) 941 try_job_key, culprits_info, False)
914 942
915 expected_culprits_info = { 943 expected_culprits_info = {
916 'step1 on platform': { 944 'step1 on platform': {
917 'try_jobs': [ 945 'try_jobs': [
918 { 946 {
919 'ref_name': 'step1', 947 'ref_name': 'step1',
920 'try_job_key': try_job_key, 948 'try_job_key': try_job_key,
921 'tests': ['test2', 'test3'], 949 'tests': ['test2', 'test3'],
922 'status': analysis_status.PENDING 950 'status': analysis_status.PENDING
923 } 951 }
(...skipping 19 matching lines...) Expand all
943 try_job.status = analysis_status.RUNNING 971 try_job.status = analysis_status.RUNNING
944 try_job.test_results = [ 972 try_job.test_results = [
945 { 973 {
946 'url': ('http://build.chromium.org/p/tryserver.chromium.' 974 'url': ('http://build.chromium.org/p/tryserver.chromium.'
947 'linux/builders/linux_chromium_variable/builds/121'), 975 'linux/builders/linux_chromium_variable/builds/121'),
948 'try_job_id': '121' 976 'try_job_id': '121'
949 } 977 }
950 ] 978 ]
951 try_job.put() 979 try_job.put()
952 handlers_util._GetCulpritInfoForTryJobResultForTest( 980 handlers_util._GetCulpritInfoForTryJobResultForTest(
953 try_job_key, culprits_info) 981 try_job_key, culprits_info, False)
954 982
955 expected_culprits_info = { 983 expected_culprits_info = {
956 'step1 on platform': { 984 'step1 on platform': {
957 'try_jobs': [ 985 'try_jobs': [
958 { 986 {
959 'ref_name': 'step1', 987 'ref_name': 'step1',
960 'try_job_key': try_job_key, 988 'try_job_key': try_job_key,
961 'tests': ['test2', 'test3'], 989 'tests': ['test2', 'test3'],
962 'status': analysis_status.RUNNING, 990 'status': analysis_status.RUNNING,
963 'try_job_url': ( 991 'try_job_url': (
964 'http://build.chromium.org/p/tryserver.chromium.' 992 'http://build.chromium.org/p/tryserver.chromium.'
965 'linux/builders/linux_chromium_variable/builds/121'), 993 'linux/builders/linux_chromium_variable/builds/121'),
966 'try_job_build_number': 121 994 'try_job_build_number': 121
967 } 995 }
968 ] 996 ]
969 } 997 }
970 } 998 }
971 self.assertEqual(expected_culprits_info, culprits_info) 999 self.assertEqual(expected_culprits_info, culprits_info)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698