def test_handler_gc_retry_connection_error(self): scheduling_queue_handler = handler.ActionExecutionSchedulingQueueHandler() scheduling_queue_handler._handle_garbage_collection() # Make sure retry occurs and that _handle_execution in process is called. calls = [mock.call(MOCK_QUEUE_ITEM, publish=False)] ex_q_db_access.ActionExecutionSchedulingQueue.add_or_update.assert_has_calls(calls)
def test_handler_retry_connection_error(self): scheduling_queue_handler = handler.ActionExecutionSchedulingQueueHandler() scheduling_queue_handler.process() # Make sure retry occurs and that _handle_execution in process is called. calls = [mock.call(scheduling_queue_handler._handle_execution, MOCK_QUEUE_ITEM)] eventlet.GreenPool.spawn.assert_has_calls(calls)
def test_handler_gc_retries_exhausted(self): scheduling_queue_handler = handler.ActionExecutionSchedulingQueueHandler() self.assertRaises( pymongo.errors.ConnectionFailure, scheduling_queue_handler._handle_garbage_collection ) self.assertEqual(ex_q_db_access.ActionExecutionSchedulingQueue.add_or_update.call_count, 0)
def test_handler_gc_unexpected_error(self): scheduling_queue_handler = handler.ActionExecutionSchedulingQueueHandler() self.assertRaises( KeyError, scheduling_queue_handler._handle_garbage_collection ) self.assertEqual(ex_q_db_access.ActionExecutionSchedulingQueue.add_or_update.call_count, 0)
def test_handler_retry_unexpected_error(self): scheduling_queue_handler = handler.ActionExecutionSchedulingQueueHandler( ) self.assertRaises(KeyError, scheduling_queue_handler.process) self.assertEqual(eventlet.GreenPool.spawn.call_count, 0)
def test_handler_retries_exhausted(self): scheduling_queue_handler = handler.ActionExecutionSchedulingQueueHandler( ) self.assertRaises(pymongo.errors.ConnectionFailure, scheduling_queue_handler.process) self.assertEqual(eventlet.GreenPool.spawn.call_count, 0)