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

Side by Side Diff: appengine/findit/waterfall/test/try_job_util_test.py

Issue 2179283009: [Findit] Compare lists to lists instead of lists to tuples, and change tests (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: 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
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 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 datetime import datetime 5 from datetime import datetime
6 from datetime import timedelta 6 from datetime import timedelta
7 7
8 from common.waterfall import failure_type 8 from common.waterfall import failure_type
9 from model import analysis_status 9 from model import analysis_status
10 from model.wf_analysis import WfAnalysis 10 from model.wf_analysis import WfAnalysis
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 # Run pipeline with signals that have the same failed output nodes. 394 # Run pipeline with signals that have the same failed output nodes.
395 # Observe no new group creation. 395 # Observe no new group creation.
396 self.assertFalse(try_job_util._IsBuildFailureUniqueAcrossPlatforms( 396 self.assertFalse(try_job_util._IsBuildFailureUniqueAcrossPlatforms(
397 master_name_2, builder_name, build_number, failure_type.COMPILE, 397 master_name_2, builder_name, build_number, failure_type.COMPILE,
398 blame_list, None, signals, None)) 398 blame_list, None, signals, None))
399 399
400 analysis_2 = WfAnalysis.Get(master_name_2, builder_name, build_number) 400 analysis_2 = WfAnalysis.Get(master_name_2, builder_name, build_number)
401 self.assertEqual( 401 self.assertEqual(
402 [master_name, builder_name, build_number], analysis_2.failure_group_key) 402 [master_name, builder_name, build_number], analysis_2.failure_group_key)
403 403
404 def testGroupCompilesWithRelatedFailures(self): 404 def testGroupCompilesWithRelatedFailuresWithHeuristicResult(self):
405 master_name = 'm1' 405 master_name = 'm1'
406 builder_name = 'b' 406 builder_name = 'b'
407 build_number = 1 407 build_number = 1
408 master_name_2 = 'm2'
409
410 blame_list = ['a']
411
412 signals = {
413 'compile': {
414 'failed_output_nodes': [
415 'abc.obj'
416 ]
417 }
418 }
419
420 heuristic_result = {
421 'failures': [
422 {
423 'step_name': 'step1',
424 'suspected_cls': [
425 {
426 'revision': 'rev1',
427 }
428 ],
429 }
430 ]
431 }
432
433 WfAnalysis.Create(master_name, builder_name, build_number).put()
434 # Run pipeline with signals that have certain failed output nodes.
435 # Observe new group creation.
436 self.assertTrue(try_job_util._IsBuildFailureUniqueAcrossPlatforms(
437 master_name, builder_name, build_number, failure_type.COMPILE,
438 blame_list, None, signals, heuristic_result))
439 self.assertTrue(WfFailureGroup.Get(master_name, builder_name, build_number))
lijeffrey 2016/07/27 22:49:36 WfFailureGroup isn't a bool, it's an entity. Inste
josiahk 2016/07/30 00:21:10 Thanks!
440
441 WfAnalysis.Create(master_name_2, builder_name, build_number).put()
442 # Run pipeline with signals that have the same failed output nodes.
443 # Observe no new group creation.
444 self.assertFalse(try_job_util._IsBuildFailureUniqueAcrossPlatforms(
445 master_name_2, builder_name, build_number, failure_type.COMPILE,
446 blame_list, None, signals, heuristic_result))
447 self.assertIsNone(
448 WfFailureGroup.Get(master_name_2, builder_name, build_number))
449
450 def testGroupCompilesWithRelatedFailuresWithoutHeuristicResult(self):
451 master_name = 'm1'
452 builder_name = 'b'
453 build_number = 1
408 master_name_2 = 'm2' 454 master_name_2 = 'm2'
409 455
410 blame_list = ['a'] 456 blame_list = ['a']
411 457
412 signals = { 458 signals = {
413 'compile': { 459 'compile': {
414 'failed_output_nodes': [ 460 'failed_output_nodes': [
415 'abc.obj' 461 'abc.obj'
416 ] 462 ]
417 } 463 }
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 } 543 }
498 ] 544 ]
499 } 545 }
500 546
501 heuristic_result_2 = { 547 heuristic_result_2 = {
502 'failures': [ 548 'failures': [
503 { 549 {
504 'step_name': 'step1', 550 'step_name': 'step1',
505 'suspected_cls': [ 551 'suspected_cls': [
506 { 552 {
507 'revision': 'rev1', 553 'revision': 'rev2',
508 } 554 }
509 ], 555 ],
510 } 556 }
511 ] 557 ]
512 } 558 }
513 559
514 WfAnalysis.Create(master_name, builder_name, build_number).put() 560 WfAnalysis.Create(master_name, builder_name, build_number).put()
515 # Run pipeline with signals that have certain failed output nodes. 561 # Run pipeline with signals that have certain failed output nodes.
516 # Observe new group creation. 562 # Observe new group creation.
517 self.assertTrue(try_job_util._IsBuildFailureUniqueAcrossPlatforms( 563 self.assertTrue(try_job_util._IsBuildFailureUniqueAcrossPlatforms(
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 WfAnalysis.Create(master_name, builder_name, build_number).put() 628 WfAnalysis.Create(master_name, builder_name, build_number).put()
583 # Run pipeline with signals that have zero failed steps. 629 # Run pipeline with signals that have zero failed steps.
584 # Observe that the build failure is unique, but there is no new group 630 # Observe that the build failure is unique, but there is no new group
585 # creation. 631 # creation.
586 self.assertTrue(try_job_util._IsBuildFailureUniqueAcrossPlatforms( 632 self.assertTrue(try_job_util._IsBuildFailureUniqueAcrossPlatforms(
587 master_name, builder_name, build_number, failure_type.TEST, blame_list, 633 master_name, builder_name, build_number, failure_type.TEST, blame_list,
588 failed_steps, None, None)) 634 failed_steps, None, None))
589 self.assertIsNone( 635 self.assertIsNone(
590 WfFailureGroup.Get(master_name, builder_name, build_number)) 636 WfFailureGroup.Get(master_name, builder_name, build_number))
591 637
592 def testGroupTestsWithRelatedSteps(self): 638 def testGroupTestsWithRelatedStepsWithHeuristicResult(self):
593 master_name = 'm1' 639 master_name = 'm1'
594 builder_name = 'b' 640 builder_name = 'b'
595 build_number = 1 641 build_number = 1
642 master_name_2 = 'm2'
643
644 blame_list = ['a']
645
646 failed_steps = {
647 'step_a': {
648 'current_failure': 3,
649 'first_failure': 2,
650 'last_pass': 1
651 }
652 }
653
654 heuristic_result = {
655 'failures': [
656 {
657 'step_name': 'step1',
658 'suspected_cls': [
659 {
660 'revision': 'rev1',
661 }
662 ],
663 }
664 ]
665 }
666
667 WfAnalysis.Create(master_name, builder_name, build_number).put()
668 # Run pipeline with signals that have certain failed steps.
669 # Observe new group creation.
670 self.assertTrue(try_job_util._IsBuildFailureUniqueAcrossPlatforms(
671 master_name, builder_name, build_number, failure_type.TEST, blame_list,
672 failed_steps, None, heuristic_result))
673 self.assertTrue(WfFailureGroup.Get(master_name, builder_name, build_number))
674
675 WfAnalysis.Create(master_name_2, builder_name, build_number).put()
676 # Run pipeline with signals that have the same failed steps.
677 # Observe no new group creation.
678 self.assertFalse(try_job_util._IsBuildFailureUniqueAcrossPlatforms(
679 master_name_2, builder_name, build_number, failure_type.TEST,
680 blame_list, failed_steps, None, heuristic_result))
681 self.assertIsNone(
682 WfFailureGroup.Get(master_name_2, builder_name, build_number))
683
684 def testGroupTestsWithRelatedStepsWithoutHeuristicResult(self):
685 master_name = 'm1'
686 builder_name = 'b'
687 build_number = 1
596 master_name_2 = 'm2' 688 master_name_2 = 'm2'
597 689
598 blame_list = ['a'] 690 blame_list = ['a']
599 691
600 failed_steps = { 692 failed_steps = {
601 'step_a': { 693 'step_a': {
602 'current_failure': 3, 694 'current_failure': 3,
603 'first_failure': 2, 695 'first_failure': 2,
604 'last_pass': 1 696 'last_pass': 1
605 } 697 }
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 } 775 }
684 ] 776 ]
685 } 777 }
686 778
687 heuristic_result_2 = { 779 heuristic_result_2 = {
688 'failures': [ 780 'failures': [
689 { 781 {
690 'step_name': 'step1', 782 'step_name': 'step1',
691 'suspected_cls': [ 783 'suspected_cls': [
692 { 784 {
693 'revision': 'rev1', 785 'revision': 'rev2',
694 } 786 }
695 ], 787 ],
696 } 788 }
697 ] 789 ]
698 } 790 }
699 791
700 WfAnalysis.Create(master_name, builder_name, build_number).put() 792 WfAnalysis.Create(master_name, builder_name, build_number).put()
701 # Run pipeline with signals that have certain failed steps. 793 # Run pipeline with signals that have certain failed steps.
702 # Observe new group creation. 794 # Observe new group creation.
703 self.assertTrue(try_job_util._IsBuildFailureUniqueAcrossPlatforms( 795 self.assertTrue(try_job_util._IsBuildFailureUniqueAcrossPlatforms(
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
1213 try_job_util._GetSuspectsFromHeuristicResult(heuristic_result)) 1305 try_job_util._GetSuspectsFromHeuristicResult(heuristic_result))
1214 1306
1215 def testShouldBailOutforOutdatedBuild(self): 1307 def testShouldBailOutforOutdatedBuild(self):
1216 yesterday = datetime.utcnow() - timedelta(days=1) 1308 yesterday = datetime.utcnow() - timedelta(days=1)
1217 build = WfBuild.Create('m', 'b', 1) 1309 build = WfBuild.Create('m', 'b', 1)
1218 build.start_time = yesterday 1310 build.start_time = yesterday
1219 self.assertTrue(try_job_util._ShouldBailOutForOutdatedBuild(build)) 1311 self.assertTrue(try_job_util._ShouldBailOutForOutdatedBuild(build))
1220 1312
1221 build.start_time = yesterday + timedelta(hours=1) 1313 build.start_time = yesterday + timedelta(hours=1)
1222 self.assertFalse(try_job_util._ShouldBailOutForOutdatedBuild(build)) 1314 self.assertFalse(try_job_util._ShouldBailOutForOutdatedBuild(build))
OLDNEW
« no previous file with comments | « no previous file | appengine/findit/waterfall/try_job_util.py » ('j') | appengine/findit/waterfall/try_job_util.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698