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

Side by Side Diff: tests/try_server_test.py

Issue 23483019: Changes to support One-Click Revert in Commit Queue (Closed) Base URL: https://src.chromium.org/chrome/trunk/tools/commit-queue/
Patch Set: Created 7 years, 3 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 | « tests/project_test.py ('k') | verification/committer_revert.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Unit tests for verification/try_server.py.""" 6 """Unit tests for verification/try_server.py."""
7 7
8 import json 8 import json
9 import logging 9 import logging
10 import optparse 10 import optparse
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 linux_build=linux_build, mac_build=mac_build, 455 linux_build=linux_build, mac_build=mac_build,
456 linux_state=linux_state, mac_state=mac_state, 456 linux_state=linux_state, mac_state=mac_state,
457 linux_name=linux_name, mac_name=mac_name) 457 linux_name=linux_name, mac_name=mac_name)
458 458
459 if is_failure(status_linux) and is_failure(status_mac): 459 if is_failure(status_linux) and is_failure(status_mac):
460 self.try_server.check_calls( 460 self.try_server.check_calls(
461 [ 'builders/?select=linux&select=mac', 461 [ 'builders/?select=linux&select=mac',
462 'builders/linux/builds/_all', 'builders/mac/builds/_all']) 462 'builders/linux/builds/_all', 'builders/mac/builds/_all'])
463 self.context.checkout.check_calls( 463 self.context.checkout.check_calls(
464 [ 'prepare(123)', 464 [ 'prepare(123)',
465 'apply_patch(%r)' % self.context.rietveld.patchsets[-2], 465 'apply_patch(%r, revert=False)' % (
466 self.context.rietveld.patchsets[-2]),
466 'prepare(123)', 467 'prepare(123)',
467 'apply_patch(%r)' % self.context.rietveld.patchsets[-1]]) 468 'apply_patch(%r, revert=False)' % (
469 self.context.rietveld.patchsets[-1])])
468 elif is_failure(status_linux): 470 elif is_failure(status_linux):
469 self.try_server.check_calls( 471 self.try_server.check_calls(
470 ['builders/?select=linux', 'builders/linux/builds/_all']) 472 ['builders/?select=linux', 'builders/linux/builds/_all'])
471 self.context.checkout.check_calls( 473 self.context.checkout.check_calls(
472 [ 'prepare(123)', 474 [ 'prepare(123)',
473 'apply_patch(%r)' % self.context.rietveld.patchsets[-1]]) 475 'apply_patch(%r, revert=False)' % (
476 self.context.rietveld.patchsets[-1])])
474 else: 477 else:
475 self.try_server.check_calls( 478 self.try_server.check_calls(
476 ['builders/?select=mac', 'builders/mac/builds/_all']) 479 ['builders/?select=mac', 'builders/mac/builds/_all'])
477 self.context.checkout.check_calls( 480 self.context.checkout.check_calls(
478 [ 'prepare(123)', 481 [ 'prepare(123)',
479 'apply_patch(%r)' % self.context.rietveld.patchsets[-1]]) 482 'apply_patch(%r, revert=False)' % (
483 self.context.rietveld.patchsets[-1])])
480 else: 484 else:
481 self.assertPending(base.SUCCEEDED, 2, None) 485 self.assertPending(base.SUCCEEDED, 2, None)
482 self.try_server.check_calls( 486 self.try_server.check_calls(
483 [ 'builders/?select=linux&select=mac', 487 [ 'builders/?select=linux&select=mac',
484 'builders/linux/builds/_all', 'builders/mac/builds/_all']) 488 'builders/linux/builds/_all', 'builders/mac/builds/_all'])
485 count = 6 + 3 * ( 489 count = 6 + 3 * (
486 int(is_failure(status_linux)) + int(is_failure(status_mac))) 490 int(is_failure(status_linux)) + int(is_failure(status_mac)))
487 self.context.status.check_names(['try server'] * count) 491 self.context.status.check_names(['try server'] * count)
488 492
489 def testImmediateSuccess(self): 493 def testImmediateSuccess(self):
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 self.assertPending( 696 self.assertPending(
693 base.SUCCEEDED, 2, None, mac_sent=self.timestamp[1], 697 base.SUCCEEDED, 2, None, mac_sent=self.timestamp[1],
694 linux_build=0, mac_build=0, 698 linux_build=0, mac_build=0,
695 mac_name='42-23 (previous was lost)') 699 mac_name='42-23 (previous was lost)')
696 self.try_server.check_calls( 700 self.try_server.check_calls(
697 ['builders/?select=mac', 'builders/mac/builds/_all']) 701 ['builders/?select=mac', 'builders/mac/builds/_all'])
698 702
699 self.try_runner.update_status([self.pending]) 703 self.try_runner.update_status([self.pending])
700 self.context.checkout.check_calls( 704 self.context.checkout.check_calls(
701 [ 'prepare(123)', 705 [ 'prepare(123)',
702 'apply_patch(%r)' % self.context.rietveld.patchsets[-1]]) 706 'apply_patch(%r, revert=False)' % (
707 self.context.rietveld.patchsets[-1])])
703 self.context.status.check_names(['try server'] * 7) 708 self.context.status.check_names(['try server'] * 7)
704 709
705 def testFailedStepRetryLkgr(self): 710 def testFailedStepRetryLkgr(self):
706 self.try_runner.verify(self.pending) 711 self.try_runner.verify(self.pending)
707 self.try_server.check_calls( 712 self.try_server.check_calls(
708 ['trychange b={linux:test1,test2, mac:test1,test2} c=False r=sol@123']) 713 ['trychange b={linux:test1,test2, mac:test1,test2} c=False r=sol@123'])
709 self.try_server.add_build( 714 self.try_server.add_build(
710 'linux', 123, None, [SUCCESS, SUCCESS, FAILURE, SUCCESS]) 715 'linux', 123, None, [SUCCESS, SUCCESS, FAILURE, SUCCESS])
711 716
712 self.lkgr = 122 717 self.lkgr = 122
713 self.try_runner.update_status([self.pending]) 718 self.try_runner.update_status([self.pending])
714 self.try_server.check_calls( 719 self.try_server.check_calls(
715 [ 'builders/?select=linux&select=mac', 720 [ 'builders/?select=linux&select=mac',
716 'builders/linux/builds/_all', 'builders/mac/builds/_all', 721 'builders/linux/builds/_all', 'builders/mac/builds/_all',
717 # Only the failed test is retried, on lkgr revision. 722 # Only the failed test is retried, on lkgr revision.
718 'trychange b={linux:test1} c=False r=sol@122 n=42-23 (retry)']) 723 'trychange b={linux:test1} c=False r=sol@122 n=42-23 (retry)'])
719 self.assertEqual(['test1'], self.get_verif().try_jobs[0].failed_steps) 724 self.assertEqual(['test1'], self.get_verif().try_jobs[0].failed_steps)
720 self.context.checkout.check_calls( 725 self.context.checkout.check_calls(
721 [ 'prepare(122)', 726 [ 'prepare(122)',
722 'apply_patch(%r)' % self.context.rietveld.patchsets[-1]]) 727 'apply_patch(%r, revert=False)' % (
728 self.context.rietveld.patchsets[-1])])
723 self.context.status.check_names(['try server'] * 5) 729 self.context.status.check_names(['try server'] * 5)
724 730
725 def testFailedUpdate(self): 731 def testFailedUpdate(self):
726 # It must not retry a failed update. 732 # It must not retry a failed update.
727 # Add succeededing builds, this sets quality to True, which disable retry 733 # Add succeededing builds, this sets quality to True, which disable retry
728 # mechanism. 734 # mechanism.
729 self.try_server.add_build( 735 self.try_server.add_build(
730 'linux', 123, 'georges tried stuff', 736 'linux', 123, 'georges tried stuff',
731 [SUCCESS, SUCCESS, SUCCESS, SUCCESS]) 737 [SUCCESS, SUCCESS, SUCCESS, SUCCESS])
732 self.try_server.add_build( 738 self.try_server.add_build(
(...skipping 26 matching lines...) Expand all
759 # It must retry once a non-clobber compile. 765 # It must retry once a non-clobber compile.
760 self.try_runner.verify(self.pending) 766 self.try_runner.verify(self.pending)
761 self.try_server.check_calls( 767 self.try_server.check_calls(
762 ['trychange b={linux:test1,test2, mac:test1,test2} c=False r=sol@123']) 768 ['trychange b={linux:test1,test2, mac:test1,test2} c=False r=sol@123'])
763 self.try_server.add_build( 769 self.try_server.add_build(
764 'linux', 123, None, [SUCCESS, FAILURE, None, None]) 770 'linux', 123, None, [SUCCESS, FAILURE, None, None])
765 self.lkgr = 122 771 self.lkgr = 122
766 self.try_runner.update_status([self.pending]) 772 self.try_runner.update_status([self.pending])
767 self.context.checkout.check_calls( 773 self.context.checkout.check_calls(
768 [ 'prepare(122)', 774 [ 'prepare(122)',
769 'apply_patch(%r)' % self.context.rietveld.patchsets[-1]]) 775 'apply_patch(%r, revert=False)' % (
776 self.context.rietveld.patchsets[-1])])
770 self.try_server.check_calls( 777 self.try_server.check_calls(
771 [ 'builders/?select=linux&select=mac', 778 [ 'builders/?select=linux&select=mac',
772 'builders/linux/builds/_all', 'builders/mac/builds/_all', 779 'builders/linux/builds/_all', 'builders/mac/builds/_all',
773 # Retries at lkgr. 780 # Retries at lkgr.
774 'trychange b={linux:test1,test2} c=True r=sol@122 n=42-23 (retry)']) 781 'trychange b={linux:test1,test2} c=True r=sol@122 n=42-23 (retry)'])
775 self.assertEqual(['compile'], self.get_verif().try_jobs[0].failed_steps) 782 self.assertEqual(['compile'], self.get_verif().try_jobs[0].failed_steps)
776 self.assertPending( 783 self.assertPending(
777 base.PROCESSING, 2, None, linux_rev=122, 784 base.PROCESSING, 2, None, linux_rev=122,
778 linux_clobber=True, linux_build=None, mac_build=None, 785 linux_clobber=True, linux_build=None, mac_build=None,
779 linux_name='42-23 (retry)') 786 linux_name='42-23 (retry)')
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 'linux', 123)) 884 'linux', 123))
878 self.context.status.check_names(['try server'] * 3) 885 self.context.status.check_names(['try server'] * 3)
879 886
880 887
881 if __name__ == '__main__': 888 if __name__ == '__main__':
882 logging.basicConfig( 889 logging.basicConfig(
883 level=[logging.WARNING, logging.INFO, logging.DEBUG][ 890 level=[logging.WARNING, logging.INFO, logging.DEBUG][
884 min(sys.argv.count('-v'), 2)], 891 min(sys.argv.count('-v'), 2)],
885 format='%(levelname)5s %(module)15s(%(lineno)3d): %(message)s') 892 format='%(levelname)5s %(module)15s(%(lineno)3d): %(message)s')
886 unittest.main() 893 unittest.main()
OLDNEW
« no previous file with comments | « tests/project_test.py ('k') | verification/committer_revert.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698