예제 #1
0
    def setUp(self):
        super(TestRealNotification, self).setUp()
        self.CONF = self.useFixture(config.Config()).conf
        self.useFixture(oslo.messaging.conffixture.ConfFixture(self.CONF))

        pipeline = yaml.dump([{
            'name': 'test_pipeline',
            'interval': 5,
            'counters': ['instance', 'memory'],
            'transformers': [],
            'publishers': ['test://'],
        }])

        self.expected_samples = 2
        self.sem = eventlet.semaphore.Semaphore(0)

        pipeline_cfg_file = fileutils.write_to_tempfile(content=pipeline,
                                                        prefix="pipeline",
                                                        suffix="yaml")
        self.CONF.set_override("pipeline_cfg_file", pipeline_cfg_file)
        self.CONF.set_override("notification_driver", "messaging")
        self.CONF.set_override("control_exchange", "nova")
        messaging.setup('fake://')
        self.addCleanup(messaging.cleanup)

        self.srv = notification.NotificationService()
예제 #2
0
    def setUp(self):
        super(TestCollector, self).setUp()
        messaging.setup('fake://')
        self.addCleanup(messaging.cleanup)
        self.CONF = self.useFixture(config.Config()).conf
        self.CONF.set_override("connection", "log://", group='database')
        self.srv = collector.CollectorService()
        self.CONF.publisher.metering_secret = 'not-so-secret'
        self.counter = sample.Sample(
            name='foobar',
            type='bad',
            unit='F',
            volume=1,
            user_id='jd',
            project_id='ceilometer',
            resource_id='cat',
            timestamp='NOW!',
            resource_metadata={},
        ).as_dict()

        self.utf8_msg = utils.meter_message_from_counter(
            sample.Sample(
                name=u'test',
                type=sample.TYPE_CUMULATIVE,
                unit=u'',
                volume=1,
                user_id=u'test',
                project_id=u'test',
                resource_id=u'test_run_tasks',
                timestamp=u'NOW!',
                resource_metadata={u'name': [([u'TestPublish'])]},
                source=u'testsource',
            ), 'not-so-secret')
예제 #3
0
    def setUp(self):
        super(TestCollector, self).setUp()
        messaging.setup('fake://')
        self.addCleanup(messaging.cleanup)
        self.CONF = self.useFixture(config.Config()).conf
        self.CONF.set_override("connection", "log://", group='database')
        self.srv = collector.CollectorService()
        self.CONF.publisher.metering_secret = 'not-so-secret'
        self.counter = sample.Sample(
            name='foobar',
            type='bad',
            unit='F',
            volume=1,
            user_id='jd',
            project_id='ceilometer',
            resource_id='cat',
            timestamp='NOW!',
            resource_metadata={},
        ).as_dict()

        self.utf8_msg = utils.meter_message_from_counter(
            sample.Sample(
                name=u'test',
                type=sample.TYPE_CUMULATIVE,
                unit=u'',
                volume=1,
                user_id=u'test',
                project_id=u'test',
                resource_id=u'test_run_tasks',
                timestamp=u'NOW!',
                resource_metadata={u'name': [([u'TestPublish'])]},
                source=u'testsource',
            ),
            'not-so-secret')
예제 #4
0
 def setUp(self):
     super(TestNotification, self).setUp()
     self.CONF = self.useFixture(config.Config()).conf
     messaging.setup('fake://')
     self.addCleanup(messaging.cleanup)
     self.CONF.set_override("connection", "log://", group='database')
     self.CONF.set_override("store_events", False, group="notification")
     self.srv = notification.NotificationService()
예제 #5
0
    def setUp(self):
        super(TestPublish, self).setUp()
        self.CONF = self.useFixture(config.Config()).conf

        messaging.setup('fake://')
        self.addCleanup(messaging.cleanup)

        self.published = []
예제 #6
0
 def setUp(self):
     super(TestNotification, self).setUp()
     self.CONF = self.useFixture(config.Config()).conf
     messaging.setup('fake://')
     self.addCleanup(messaging.cleanup)
     self.CONF.set_override("connection", "log://", group='database')
     self.CONF.set_override("store_events", False, group="notification")
     self.srv = notification.NotificationService()
예제 #7
0
    def setUp(self):
        super(TestPublish, self).setUp()
        self.CONF = self.useFixture(config.Config()).conf

        messaging.setup('fake://')
        self.addCleanup(messaging.cleanup)

        self.published = []
예제 #8
0
    def setUp(self):
        super(TestEventEndpoint, self).setUp()
        self.CONF = self.useFixture(config.Config()).conf
        self.CONF([])
        messaging.setup('fake://')
        self.addCleanup(messaging.cleanup)
        self.CONF.set_override("connection", "log://", group='database')
        self.CONF.set_override("store_events", True, group="notification")

        self.mock_dispatcher = mock.MagicMock()
        self.endpoint = event_endpoint.EventsNotificationEndpoint()
        self.endpoint.dispatcher_manager = \
            extension.ExtensionManager.make_test_instance([
                extension.Extension('test', None, None, self.mock_dispatcher)
            ])
        self.endpoint.event_converter = mock.MagicMock()
        self.endpoint.event_converter.to_event.return_value = mock.MagicMock(
            event_type='test.test')
예제 #9
0
    def setUp(self):
        super(TestEventEndpoint, self).setUp()
        self.CONF = self.useFixture(config.Config()).conf
        self.CONF([])
        messaging.setup('fake://')
        self.addCleanup(messaging.cleanup)
        self.CONF.set_override("connection", "log://", group='database')
        self.CONF.set_override("store_events", True, group="notification")

        self.mock_dispatcher = mock.MagicMock()
        self.endpoint = event_endpoint.EventsNotificationEndpoint()
        self.endpoint.dispatcher_manager = \
            extension.ExtensionManager.make_test_instance([
                extension.Extension('test', None, None, self.mock_dispatcher)
            ])
        self.endpoint.event_converter = mock.MagicMock()
        self.endpoint.event_converter.to_event.return_value = mock.MagicMock(
            event_type='test.test')
    def setUp(self):
        super(TestRealNotification, self).setUp()
        self.CONF = self.useFixture(config.Config()).conf
        self.useFixture(oslo.messaging.conffixture.ConfFixture(self.CONF))

        pipeline = yaml.dump([{
            'name': 'test_pipeline',
            'interval': 5,
            'counters': ['*'],
            'transformers': [],
            'publishers': ['test://'],
        }])
        pipeline_cfg_file = fileutils.write_to_tempfile(content=pipeline,
                                                        prefix="pipeline",
                                                        suffix="yaml")
        self.CONF.set_override("pipeline_cfg_file", pipeline_cfg_file)
        self.CONF.set_override("notification_driver", "messaging")
        self.CONF.set_override("control_exchange", "nova")
        messaging.setup('fake://')
        self.addCleanup(messaging.cleanup)

        self.srv = notification.NotificationService()
예제 #11
0
 def _setup_messaging(self, url):
     messaging.cleanup()
     self.CONF.set_override('rpc_backend', '')
     messaging.setup(url, optional=True)