def setup_common(possible_topdir, service_name): dev_conf = os.path.join(possible_topdir, 'etc', 'sahara', 'sahara.conf') config_files = None if os.path.exists(dev_conf): config_files = [dev_conf] config.parse_configs(config_files) log.setup("sahara") LOG.info(_LI('Starting Sahara %s'), service_name) # Validate other configurations (that may produce logs) here cinder.validate_config() messaging.setup() if service_name != 'all-in-one': LOG.warn( _LW("Distributed mode is in the alpha state, it's recommended to " "use all-in-one mode by running 'sahara-all' binary.")) plugins_base.setup_plugins()
def test_only_notifications(self): self.override_config('enable', True, group='oslo_messaging_notifications') messaging.setup('all-in-one') self.assertEqual(0, self.get_transport.call_count) self.assertEqual(1, self.get_notify_transport.call_count)
def setup_common(possible_topdir, service_name): dev_conf = os.path.join(possible_topdir, 'etc', 'sahara', 'sahara.conf') config_files = None if os.path.exists(dev_conf): config_files = [dev_conf] config.parse_configs(config_files) common_config.set_config_defaults() log.setup(CONF, "sahara") # Validate other configurations (that may produce logs) here cinder.validate_config() keystone.validate_config() validate_castellan_config() messaging.setup(service_name) plugins_base.setup_plugins() ds_manager.setup_data_sources() jb_manager.setup_job_binaries() LOG.info('Sahara {service} started'.format(service=service_name))
def test_update_cluster(self, mock_notify): self.override_config("enable_notifications", True) messaging.setup() self._make_sample() self.assertEqual([self.expected], mock_notify.call_args_list) if messaging.TRANSPORT: messaging.TRANSPORT.cleanup() messaging.TRANSPORT = messaging.NOTIFIER = None
def test_set_defaults(self): messaging.setup('distributed') self.assertIsNotNone(messaging.MESSAGING_TRANSPORT) self.assertIsNotNone(messaging.NOTIFICATION_TRANSPORT) self.assertIsNotNone(messaging.NOTIFIER) expected = [mock.call('sahara')] self.assertEqual(expected, self.set_transport_def.call_args_list) self.assertEqual([mock.call(main.CONF)], self.get_transport.call_args_list) self.assertEqual([mock.call(main.CONF)], self.get_notify_transport.call_args_list) self.assertEqual(1, self.notifier_init.call_count)
def setup_common(possible_topdir, service_name): dev_conf = os.path.join(possible_topdir, "etc", "sahara", "sahara.conf") config_files = None if os.path.exists(dev_conf): config_files = [dev_conf] config.parse_configs(config_files) log.setup(CONF, "sahara") # Validate other configurations (that may produce logs) here cinder.validate_config() if service_name != "all-in-one" or cfg.CONF.enable_notifications: messaging.setup() plugins_base.setup_plugins() LOG.info(_LI("Sahara {service} started").format(service=service_name))
def setup_common(possible_topdir, service_name): dev_conf = os.path.join(possible_topdir, 'etc', 'sahara', 'sahara.conf') config_files = None if os.path.exists(dev_conf): config_files = [dev_conf] config.parse_configs(config_files) log.setup(CONF, "sahara") # Validate other configurations (that may produce logs) here cinder.validate_config() if service_name != 'all-in-one' or cfg.CONF.enable_notifications: messaging.setup() plugins_base.setup_plugins() LOG.info(_LI('Sahara {service} started').format(service=service_name))
def test_set_defaults(self): messaging.setup('distributed') self.assertIsNotNone(messaging.MESSAGING_TRANSPORT) self.assertIsNotNone(messaging.NOTIFICATION_TRANSPORT) self.assertIsNotNone(messaging.NOTIFIER) expected = [ mock.call('sahara') ] self.assertEqual(expected, self.set_transport_def.call_args_list) self.assertEqual( [mock.call(main.CONF)], self.get_transport.call_args_list) self.assertEqual( [mock.call(main.CONF)], self.get_notify_transport.call_args_list) self.assertEqual(1, self.notifier_init.call_count)
def test_set_defaults(self): self.override_config('enable', True, group='oslo_messaging_notifications') messaging.setup('distributed') self.assertIsNotNone(messaging.MESSAGING_TRANSPORT) self.assertIsNotNone(messaging.NOTIFICATION_TRANSPORT) self.assertIsNotNone(messaging.NOTIFIER) expected = [ mock.call('sahara') ] self.assertEqual(expected, self.set_transport_def.call_args_list) self.assertEqual( [mock.call(main.CONF, aliases=_ALIASES)], self.get_transport.call_args_list) self.assertEqual( [mock.call(main.CONF, aliases=_ALIASES)], self.get_notify_transport.call_args_list) self.assertEqual(1, self.notifier_init.call_count)
def test_fallback(self): self.get_notify_transport.side_effect = ValueError() messaging.setup('distributed') self.assertIsNotNone(messaging.MESSAGING_TRANSPORT) self.assertIsNotNone(messaging.NOTIFICATION_TRANSPORT) self.assertEqual( messaging.MESSAGING_TRANSPORT, messaging.NOTIFICATION_TRANSPORT) self.assertIsNotNone(messaging.NOTIFIER) expected = [ mock.call('sahara') ] self.assertEqual(expected, self.set_transport_def.call_args_list) self.assertEqual( [mock.call(main.CONF, aliases=_ALIASES)], self.get_transport.call_args_list) self.assertEqual( [mock.call(main.CONF, aliases=_ALIASES)], self.get_notify_transport.call_args_list) self.assertEqual(1, self.notifier_init.call_count)
def setup_common(possible_topdir, service_name): dev_conf = os.path.join(possible_topdir, 'etc', 'sahara', 'sahara.conf') config_files = None if os.path.exists(dev_conf): config_files = [dev_conf] config.parse_configs(config_files) common_config.set_config_defaults() log.setup(CONF, "sahara") # Validate other configurations (that may produce logs) here cinder.validate_config() castellan.validate_config() if (service_name != 'all-in-one' or CONF.oslo_messaging_notifications.enable): messaging.setup() plugins_base.setup_plugins() LOG.info(_LI('Sahara {service} started').format(service=service_name))
def test_only_service_messaging(self): messaging.setup('distributed') self.assertEqual(1, self.get_transport.call_count) self.assertEqual(0, self.get_notify_transport.call_count)
def _install(self): messaging.setup('fake://', optional=True) self.assertNotEqual(None, messaging.TRANSPORT) self.assertNotEqual(None, messaging.NOTIFIER)
def rpc_setup(service_name, **kwargs): rpc.setup(service_name)
def _install(self): messaging.setup() self.assertIsNotNone(messaging.TRANSPORT) self.assertIsNotNone(messaging.NOTIFIER)
def setUp(self): super(SaharaTestCase, self).setUp() self.setup_context() rpc.setup('all-in-one')
def _install(self): messaging.setup() self.assertNotEqual(None, messaging.TRANSPORT) self.assertNotEqual(None, messaging.NOTIFIER)
def test_only_notifications(self): messaging.setup('all-in-one') self.assertEqual(0, self.get_transport.call_count) self.assertEqual(1, self.get_notify_transport.call_count)
def test_no_messaging(self): messaging.setup('all-in-one') self.assertEqual(0, self.get_notify_transport.call_count) self.assertEqual(0, self.get_transport.call_count)