def setUp(self): super(TestBase, self).setUp() engine = urlparse.urlparse(self.db_url).scheme # NOTE(Alexei_987) Shortcut to skip expensive db setUp test_method = self._get_test_method() if (hasattr(test_method, '_run_with') and engine not in test_method._run_with): raise testcase.TestSkipped( 'Test is not applicable for %s' % engine) self.db_manager = self._get_driver_manager(engine)(self.db_url) self.useFixture(self.db_manager) self.conn = self.db_manager.connection self.conn.upgrade() self.useFixture(oslo_mock.Patch('ceilometer.storage.get_connection', return_value=self.conn)) self.CONF = self.useFixture(config.Config()).conf self.CONF([], project='ceilometer') # Set a default location for the pipeline config file so the # tests work even if ceilometer is not installed globally on # the system. self.CONF.import_opt('pipeline_cfg_file', 'ceilometer.pipeline') self.CONF.set_override( 'pipeline_cfg_file', self.path_get('etc/ceilometer/pipeline.yaml') )
def setUp(self): super(TestBase, self).setUp() engine = urlparse.urlparse(self.db_url).scheme # NOTE(Alexei_987) Shortcut to skip expensive db setUp test_method = self._get_test_method() if (hasattr(test_method, '_run_with') and engine not in test_method._run_with): raise testcase.TestSkipped('Test is not applicable for %s' % engine) conf = service.prepare_service([]) self.CONF = self.useFixture(fixture_config.Config(conf)).conf self.CONF.set_override('connection', self.db_url, group="database") try: self.db_manager = self._get_driver_manager(engine)(self.CONF) except ValueError as exc: self.skipTest("missing driver manager: %s" % exc) self.useFixture(self.db_manager) self.CONF.set_override('connection', self.db_manager.url, group="database") self.alarm_conn = storage.get_connection_from_config(self.CONF) self.alarm_conn.upgrade() self.useFixture( mockpatch.Patch('aodh.storage.get_connection_from_config', side_effect=self._get_connection))
def setUp(self): super(MongoDbManager, self).setUp() with warnings.catch_warnings(): warnings.filterwarnings( action='ignore', message='.*you must provide a username and password.*') try: self.connection = storage.get_connection(self.url) except storage.StorageBadVersion as e: raise testcase.TestSkipped(six.text_type(e))
def setUp(self): super(TestBase, self).setUp() engine = urlparse.urlparse(self.db_url).scheme # NOTE(Alexei_987) Shortcut to skip expensive db setUp test_method = self._get_test_method() if (hasattr(test_method, '_run_with') and engine not in test_method._run_with): raise testcase.TestSkipped('Test is not applicable for %s' % engine) self.CONF = self.useFixture(fixture_config.Config()).conf self.CONF([], project='ceilometer', validate_default_values=True) try: self.db_manager = self._get_driver_manager(engine)(self.db_url) except ValueError as exc: self.skipTest("missing driver manager: %s" % exc) self.useFixture(self.db_manager) self.conn = self.db_manager.connection self.conn.upgrade() self.alarm_conn = self.db_manager.alarm_connection self.alarm_conn.upgrade() self.event_conn = self.db_manager.event_connection self.event_conn.upgrade() self.useFixture( mockpatch.Patch('ceilometer.storage.get_connection', side_effect=self._get_connection)) # Set a default location for the pipeline config file so the # tests work even if ceilometer is not installed globally on # the system. self.CONF.import_opt('pipeline_cfg_file', 'ceilometer.pipeline') self.CONF.set_override('pipeline_cfg_file', self.path_get('etc/ceilometer/pipeline.yaml'))