def setUp(self): _, self.panoptes_test_conf_file = get_test_conf_file() self._my_path = os.path.dirname(os.path.abspath(__file__)) self._panoptes_context = PanoptesContext(self.panoptes_test_conf_file) self._resource = PanoptesResource( resource_class="test_class", resource_subclass="test_subclass", resource_type="test_type", resource_id="test_id", resource_endpoint="127.0.0.1", resource_site="test_site", resource_creation_timestamp=time.time(), resource_plugin="test_plugin") self._key_value_store = PanoptesTestKeyValueStore( self._panoptes_context) self._secrets_store = TestPanoptesSecretsStore(self._panoptes_context) self._secrets_store.set(key='snmp_community_string:test_site', value='public') self._panoptes_plugin_context = PanoptesPluginContext( panoptes_context=self._panoptes_context, logger_name="test_logger", config=plugin_conf, key_value_store=self._key_value_store, secrets_store=self._secrets_store, data=self._resource)
def setUp(self): self.my_dir, self.panoptes_test_conf_file = get_test_conf_file() self._panoptes_context = PanoptesContext(self.panoptes_test_conf_file, key_value_store_class_list=[PanoptesTestKeyValueStore], create_message_producer=False, async_message_producer=False, create_zookeeper_client=True) self._celery_config = PanoptesCeleryConfig(app_name=u"Enrichment Plugin Test") self._scheduler = PanoptesPluginScheduler( panoptes_context=self._panoptes_context, plugin_type=u"enrichment", plugin_type_display_name=u"Enrichment", celery_config=self._celery_config, lock_timeout=1, plugin_scheduler_task=_callback )
def setUp(self): self.my_dir, self.panoptes_test_conf_file = get_test_conf_file()
def setUp(self): self.my_dir, self.panoptes_test_conf_file = get_test_conf_file() self._panoptes_context = PanoptesContext(self.panoptes_test_conf_file)
PanoptesMetricsGroup, PanoptesMetricDimension, PanoptesMetric, PanoptesMetricType from yahoo_panoptes.framework.resources import PanoptesResource, PanoptesResourceSet, PanoptesContext from yahoo_panoptes.framework import const from tests.test_framework import panoptes_mock_redis_strict_client from tests.mock_panoptes_producer import MockPanoptesMessageProducer from tests.mock_redis import PanoptesMockRedis from tests.helpers import get_test_conf_file path = os.path.dirname(os.path.realpath(__file__)) pwd = os.path.dirname(os.path.abspath(__file__)) plugin_results_file = u'{}/metric_group_sets/interface_plugin_results.json'.format( pwd) _, global_panoptes_test_conf_file = get_test_conf_file() class MockPanoptesObject(object): """ A mock plugin agent """ def __init__(self, **kwargs): self.__dict__.update(kwargs) class PluginAgent(TestCase): @patch(u'redis.StrictRedis', panoptes_mock_redis_strict_client) def setUp(self): self.my_dir, self.panoptes_test_conf_file = get_test_conf_file() self._panoptes_context = PanoptesContext(self.panoptes_test_conf_file)