def setUp(self): """Run before each test method to initialize test environment.""" super(TestCase, self).setUp() conf_fixture.set_defaults(CONF) CONF([], default_config_files=[]) global _DB_CACHE if not _DB_CACHE: _DB_CACHE = Database( db_api, migration, sql_connection=CONF.database.connection, sqlite_db=CONF.sqlite_db, sqlite_clean_db=CONF.sqlite_clean_db, ) self.useFixture(_DB_CACHE) self.injected = [] self._services = [] self.flags(fatal_exception_format_errors=True) # This will be cleaned up by the NestedTempfile fixture lock_path = self.useFixture(fixtures.TempDir()).path self.fixture = self.useFixture(config_fixture.Config(lockutils.CONF)) self.fixture.config(lock_path=lock_path, group='oslo_concurrency') self.fixture.config(disable_process_locking=True, group='oslo_concurrency') rpc.add_extra_exmods('manila.tests') self.addCleanup(rpc.clear_extra_exmods) self.addCleanup(rpc.cleanup) self.messaging_conf = messaging_conffixture.ConfFixture(CONF) self.messaging_conf.transport_url = 'fake:/' self.messaging_conf.response_timeout = 15 self.useFixture(self.messaging_conf) oslo_messaging.get_notification_transport(CONF) self.override_config('driver', ['test'], group='oslo_messaging_notifications') rpc.init(CONF) mock.patch('keystoneauth1.loading.load_auth_from_conf_options').start() fake_notifier.stub_notifier(self) self._disable_osprofiler() # Locks must be cleaned up after tests CONF.set_override('backend_url', 'file://' + lock_path, group='coordination') coordination.LOCK_COORDINATOR.start() self.addCleanup(coordination.LOCK_COORDINATOR.stop)
def setUp(self): """Run before each test method to initialize test environment.""" super(TestCase, self).setUp() conf_fixture.set_defaults(CONF) CONF([], default_config_files=[]) global _DB_CACHE if not _DB_CACHE: _DB_CACHE = Database( db_api, migration, sql_connection=CONF.database.connection, sqlite_db=CONF.sqlite_db, sqlite_clean_db=CONF.sqlite_clean_db, ) self.useFixture(_DB_CACHE) self.injected = [] self._services = [] self.flags(fatal_exception_format_errors=True) # This will be cleaned up by the NestedTempfile fixture lock_path = self.useFixture(fixtures.TempDir()).path self.fixture = self.useFixture(config_fixture.Config(lockutils.CONF)) self.fixture.config(lock_path=lock_path, group='oslo_concurrency') self.fixture.config( disable_process_locking=True, group='oslo_concurrency') rpc.add_extra_exmods('manila.tests') self.addCleanup(rpc.clear_extra_exmods) self.addCleanup(rpc.cleanup) self.messaging_conf = messaging_conffixture.ConfFixture(CONF) self.messaging_conf.transport_url = 'fake:/' self.messaging_conf.response_timeout = 15 self.useFixture(self.messaging_conf) oslo_messaging.get_notification_transport(CONF) self.override_config('driver', ['test'], group='oslo_messaging_notifications') rpc.init(CONF) mock.patch('keystoneauth1.loading.load_auth_from_conf_options').start() fake_notifier.stub_notifier(self) # Locks must be cleaned up after tests CONF.set_override('backend_url', 'file://' + lock_path, group='coordination') coordination.LOCK_COORDINATOR.start() self.addCleanup(coordination.LOCK_COORDINATOR.stop)
def setUp(self): """Run before each test method to initialize test environment.""" super(TestCase, self).setUp() conf_fixture.set_defaults(CONF) CONF([], default_config_files=[]) # NOTE(vish): We need a better method for creating fixtures for tests # now that we have some required db setup for the system # to work properly. self.start = timeutils.utcnow() self.log_fixture = self.useFixture(fixtures.FakeLogger()) self.useFixture(fixtures.NestedTempfile()) self.useFixture(fixtures.TempHomeDir()) global _DB_CACHE if not _DB_CACHE: _DB_CACHE = Database( db_api, migration, sql_connection=CONF.database.connection, sqlite_db=CONF.sqlite_db, sqlite_clean_db=CONF.sqlite_clean_db, ) self.useFixture(_DB_CACHE) self.stubs = StubOutForTesting(self) self.injected = [] self._services = [] CONF.set_override('fatal_exception_format_errors', True) # This will be cleaned up by the NestedTempfile fixture CONF.set_override('lock_path', tempfile.mkdtemp()) rpc.add_extra_exmods('manila.tests') self.addCleanup(rpc.clear_extra_exmods) self.addCleanup(rpc.cleanup) self.messaging_conf = messaging_conffixture.ConfFixture(CONF) self.messaging_conf.transport_driver = 'fake' self.messaging_conf.response_timeout = 15 self.useFixture(self.messaging_conf) rpc.init(CONF) fake_notifier.stub_notifier(self.stubs)
def setUp(self): """Run before each test method to initialize test environment.""" super(TestCase, self).setUp() oslo_i18n.enable_lazy(enable=False) conf_fixture.set_defaults(CONF) CONF([], default_config_files=[]) global _DB_CACHE if not _DB_CACHE: _DB_CACHE = Database( db_api, migration, sql_connection=CONF.database.connection, sqlite_db=CONF.sqlite_db, sqlite_clean_db=CONF.sqlite_clean_db, ) self.useFixture(_DB_CACHE) self.injected = [] self._services = [] self.flags(fatal_exception_format_errors=True) # This will be cleaned up by the NestedTempfile fixture lock_path = self.useFixture(fixtures.TempDir()).path self.fixture = self.useFixture(config_fixture.Config(lockutils.CONF)) self.fixture.config(lock_path=lock_path, group='oslo_concurrency') self.fixture.config(disable_process_locking=True, group='oslo_concurrency') rpc.add_extra_exmods('manila.tests') self.addCleanup(rpc.clear_extra_exmods) self.addCleanup(rpc.cleanup) self.messaging_conf = messaging_conffixture.ConfFixture(CONF) self.messaging_conf.transport_driver = 'fake' self.messaging_conf.response_timeout = 15 self.useFixture(self.messaging_conf) rpc.init(CONF) mock.patch('keystoneauth1.loading.load_auth_from_conf_options').start() fake_notifier.stub_notifier(self)
def setUp(self): """Run before each test method to initialize test environment.""" super(TestCase, self).setUp() oslo_i18n.enable_lazy(enable=False) conf_fixture.set_defaults(CONF) CONF([], default_config_files=[]) global _DB_CACHE if not _DB_CACHE: _DB_CACHE = Database( db_api, migration, sql_connection=CONF.database.connection, sqlite_db=CONF.sqlite_db, sqlite_clean_db=CONF.sqlite_clean_db, ) self.useFixture(_DB_CACHE) self.injected = [] self._services = [] self.flags(fatal_exception_format_errors=True) # This will be cleaned up by the NestedTempfile fixture lock_path = self.useFixture(fixtures.TempDir()).path self.fixture = self.useFixture(config_fixture.Config(lockutils.CONF)) self.fixture.config(lock_path=lock_path, group='oslo_concurrency') self.fixture.config( disable_process_locking=True, group='oslo_concurrency') rpc.add_extra_exmods('manila.tests') self.addCleanup(rpc.clear_extra_exmods) self.addCleanup(rpc.cleanup) self.messaging_conf = messaging_conffixture.ConfFixture(CONF) self.messaging_conf.transport_driver = 'fake' self.messaging_conf.response_timeout = 15 self.useFixture(self.messaging_conf) rpc.init(CONF) fake_notifier.stub_notifier(self)