コード例 #1
0
 def testThrottlesTreeOnOpen(self):
   """Tests that ThrottleOrCloseTheTree throttles the tree if tree is open."""
   self._SetupMockTreeStatusResponses(final_tree_status='Tree is open (taco)',
                                      final_general_state=constants.TREE_OPEN)
   with mock.patch.object(tree_status, '_UpdateTreeStatus') as m:
     tree_status.ThrottleOrCloseTheTree('foo', 'failure')
     m.assert_called_once_with(mock.ANY, 'Tree is throttled (foo: failure)')
コード例 #2
0
 def testClosesTheTreeOnClosed(self):
   """Tests ThrottleOrCloseTheTree closes the tree if tree is closed."""
   self._SetupMockTreeStatusResponses(
       final_tree_status='Tree is closed (taco)',
       final_general_state=constants.TREE_CLOSED)
   with mock.patch.object(tree_status, '_UpdateTreeStatus') as m:
     tree_status.ThrottleOrCloseTheTree('foo', 'failure')
     m.assert_called_once_with(mock.ANY,
                               'Tree is closed (foo: failure | taco)')
コード例 #3
0
 def testThrottlesTreeOnWithBuildNumberAndPublicType(self):
   """Tests that tree is throttled with the build number in the message."""
   self._SetupMockTreeStatusResponses(final_tree_status='Tree is open (taco)',
                                      final_general_state=constants.TREE_OPEN)
   with mock.patch.object(tree_status, '_UpdateTreeStatus') as m:
     tree_status.ThrottleOrCloseTheTree('foo', 'failure', buildnumber=1234,
                                        internal=False)
     m.assert_called_once_with(mock.ANY,
                               'Tree is throttled (foo-p-1234: failure)')
コード例 #4
0
 def testDiscardUpdateFromTheSameAnnouncer(self):
   """Tests we don't include messages from the same announcer."""
   self._SetupMockTreeStatusResponses(
       final_tree_status='Tree is throttled (foo: failure | bar: taco)',
       final_general_state=constants.TREE_THROTTLED)
   with mock.patch.object(tree_status, '_UpdateTreeStatus') as m:
     tree_status.ThrottleOrCloseTheTree('foo', 'failure')
     # Also make sure that previous status message is included.
     m.assert_called_once_with(mock.ANY,
                               'Tree is throttled (foo: failure | bar: taco)')
コード例 #5
0
 def testThrottlesTreeOnThrottled(self):
   """Tests ThrottleOrCloseTheTree throttles the tree if tree is throttled."""
   self._SetupMockTreeStatusResponses(
       final_tree_status='Tree is throttled (taco)',
       final_general_state=constants.TREE_THROTTLED)
   with mock.patch.object(tree_status, '_UpdateTreeStatus') as m:
     tree_status.ThrottleOrCloseTheTree('foo', 'failure')
     # Also make sure that previous status message is included.
     m.assert_called_once_with(mock.ANY,
                               'Tree is throttled (foo: failure | taco)')