コード例 #1
0
 def test_discovery_plugin_scheduler_agent_config_error(self):
     with patch(
             'yahoo_panoptes.discovery.discovery_plugin_scheduler.const.DEFAULT_CONFIG_FILE_PATH',
             self.panoptes_test_conf_file):
         mock_config = MagicMock(side_effect=Exception)
         with patch(
                 'yahoo_panoptes.discovery.discovery_plugin_scheduler.PanoptesCeleryDiscoveryAgentConfig',
                 mock_config):
             with self.assertRaises(SystemExit):
                 start_discovery_plugin_scheduler()
コード例 #2
0
 def test_celery_none(self):
     with patch(
             'yahoo_panoptes.discovery.discovery_plugin_scheduler.const.DEFAULT_CONFIG_FILE_PATH',
             self.panoptes_test_conf_file):
         mock_start = create_autospec(PanoptesPluginScheduler.start,
                                      return_value=None)
         with patch(
                 'yahoo_panoptes.discovery.discovery_plugin_scheduler.PanoptesPluginScheduler.start',
                 mock_start):
             with self.assertRaises(SystemExit):
                 start_discovery_plugin_scheduler()
コード例 #3
0
 def test_basic_operations(self):
     celery_app = self._scheduler.start()
     celery_beat_service = Service(
         celery_app,
         max_interval=None,
         schedule_filename=None,
         scheduler_cls=PanoptesCeleryPluginScheduler)
     with patch(
             'yahoo_panoptes.discovery.discovery_plugin_scheduler.const.DEFAULT_CONFIG_FILE_PATH',
             self.panoptes_test_conf_file):
         start_discovery_plugin_scheduler()
         discovery_plugin_scheduler_task(celery_beat_service)
コード例 #4
0
 def test_discovery_plugin_scheduler_task_config_error(self):
     celery_app = self._scheduler.start()
     celery_beat_service = Service(
         celery_app,
         max_interval=None,
         schedule_filename=None,
         scheduler_cls=PanoptesCeleryPluginScheduler)
     with patch(
             'yahoo_panoptes.discovery.discovery_plugin_scheduler.const.DEFAULT_CONFIG_FILE_PATH',
             self.panoptes_test_conf_file):
         mock_getmtime = MagicMock(side_effect=Exception)
         with patch(
                 'yahoo_panoptes.framework.plugins.panoptes_base_plugin.os.path.getmtime',
                 mock_getmtime):
             start_discovery_plugin_scheduler()
             discovery_plugin_scheduler_task(celery_beat_service)
コード例 #5
0
    def test_error_messages(self):
        celery_app = self._scheduler.start()
        celery_beat_service = Service(
            celery_app,
            max_interval=None,
            schedule_filename=None,
            scheduler_cls=PanoptesCeleryPluginScheduler)
        with patch(
                'yahoo_panoptes.discovery.discovery_plugin_scheduler.const.DEFAULT_CONFIG_FILE_PATH',
                self.panoptes_test_conf_file):

            mock_plugin_manager = MagicMock(side_effect=Exception)
            with patch(
                    'yahoo_panoptes.discovery.discovery_plugin_scheduler.PanoptesPluginManager',
                    mock_plugin_manager):
                start_discovery_plugin_scheduler()
                discovery_plugin_scheduler_task(celery_beat_service)