Merge "Move datasource exceptions to exceptions.py"
This commit is contained in:
commit
006e878311
|
@ -22,7 +22,7 @@ from oslo_log import log as logging
|
|||
from congress.api import api_utils
|
||||
from congress.api import webservice
|
||||
from congress.dse import deepsix
|
||||
from congress.managers import datasource as datasource_manager
|
||||
from congress import exception
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -82,7 +82,7 @@ class DatasourceDriverModel(deepsix.deepSix):
|
|||
datasource)
|
||||
driver = self.rpc(self.datasource_mgr, 'get_driver_info',
|
||||
datasource)
|
||||
except datasource_manager.DriverNotFound as e:
|
||||
except exception.DriverNotFound as e:
|
||||
raise webservice.DataModelException(e.code, str(e),
|
||||
http_status_code=e.code)
|
||||
|
||||
|
|
|
@ -370,9 +370,9 @@ class DseNode(object):
|
|||
obj = importutils.import_class(driver_path)
|
||||
driver = obj.get_datasource_info()
|
||||
if driver['id'] in result:
|
||||
raise BadConfig(_("There is a driver loaded already with the"
|
||||
"driver name of %s")
|
||||
% driver['id'])
|
||||
raise exception.BadConfig(_("There is a driver loaded already"
|
||||
"with the driver name of %s")
|
||||
% driver['id'])
|
||||
driver['module'] = driver_path
|
||||
result[driver['id']] = driver
|
||||
return result
|
||||
|
@ -380,7 +380,7 @@ class DseNode(object):
|
|||
def get_driver_info(self, driver):
|
||||
driver = self.loaded_drivers.get(driver)
|
||||
if not driver:
|
||||
raise DriverNotFound(id=driver)
|
||||
raise exception.DriverNotFound(id=driver)
|
||||
return driver
|
||||
|
||||
# Datasource CRUD. Maybe belongs in a subclass of DseNode?
|
||||
|
@ -389,7 +389,7 @@ class DseNode(object):
|
|||
"""Return the created datasource."""
|
||||
result = datasources_db.get_datasource(id_)
|
||||
if not result:
|
||||
raise DatasourceNotFound(id=id_)
|
||||
raise exception.DatasourceNotFound(id=id_)
|
||||
return cls.make_datasource_dict(result)
|
||||
|
||||
def get_datasources(self, filter_secret=False):
|
||||
|
@ -461,16 +461,16 @@ class DseNode(object):
|
|||
|
||||
self.validate_create_datasource(req)
|
||||
if self.is_valid_service(req['name']):
|
||||
raise DatasourceNameInUse(value=req['name'])
|
||||
raise exception.DatasourceNameInUse(value=req['name'])
|
||||
try:
|
||||
self.create_service(
|
||||
class_path=driver_info['module'],
|
||||
kwargs={'name': req['name'], 'args': item['config']})
|
||||
except Exception:
|
||||
raise DatasourceCreationError(value=req['name'])
|
||||
raise exception.DatasourceCreationError(value=req['name'])
|
||||
|
||||
except db_exc.DBDuplicateEntry:
|
||||
raise DatasourceNameInUse(value=req['name'])
|
||||
raise exception.DatasourceNameInUse(value=req['name'])
|
||||
new_item = dict(item)
|
||||
new_item['id'] = new_id
|
||||
return self.make_datasource_dict(new_item)
|
||||
|
@ -486,7 +486,8 @@ class DseNode(object):
|
|||
# valid configuration options that the driver exposes.
|
||||
invalid_options = specified_options - valid_options
|
||||
if invalid_options:
|
||||
raise InvalidDriverOption(invalid_options=invalid_options)
|
||||
raise exception.InvalidDriverOption(
|
||||
invalid_options=invalid_options)
|
||||
|
||||
# check that all the required options are passed in
|
||||
required_options = set(
|
||||
|
@ -495,12 +496,12 @@ class DseNode(object):
|
|||
missing_options = required_options - specified_options
|
||||
if missing_options:
|
||||
missing_options = ', '.join(missing_options)
|
||||
raise MissingRequiredConfigOptions(
|
||||
raise exception.MissingRequiredConfigOptions(
|
||||
missing_options=missing_options)
|
||||
return loaded_driver
|
||||
|
||||
# If we get here no datasource driver match was found.
|
||||
raise InvalidDriver(driver=req)
|
||||
raise exception.InvalidDriver(driver=req)
|
||||
|
||||
def create_service(self, class_path, kwargs):
|
||||
"""Create a new DataService on this node.
|
||||
|
@ -531,7 +532,7 @@ class DseNode(object):
|
|||
self.register_service(service)
|
||||
except Exception:
|
||||
# TODO(dse2): add logging for service creation failure
|
||||
raise DataServiceError(
|
||||
raise exception.DataServiceError(
|
||||
"Error loading instance of module '%s':: \n%s"
|
||||
% (class_path, traceback.format_exc()))
|
||||
|
||||
|
@ -553,7 +554,7 @@ class DseNode(object):
|
|||
result = datasources_db.delete_datasource(
|
||||
datasource_id, session)
|
||||
if not result:
|
||||
raise DatasourceNotFound(id=datasource_id)
|
||||
raise exception.DatasourceNotFound(id=datasource_id)
|
||||
self.unregister_service(datasource['name'])
|
||||
|
||||
|
||||
|
@ -575,43 +576,3 @@ class DseNodeEndpoints (object):
|
|||
for s in self.node.table_subscribers(publisher, table):
|
||||
self.node.service_object(s).receive_data(
|
||||
publisher=publisher, table=table, data=data)
|
||||
|
||||
|
||||
class DataServiceError (Exception):
|
||||
pass
|
||||
|
||||
|
||||
class BadConfig(exception.BadRequest):
|
||||
pass
|
||||
|
||||
|
||||
class DatasourceDriverException(exception.CongressException):
|
||||
pass
|
||||
|
||||
|
||||
class MissingRequiredConfigOptions(BadConfig):
|
||||
msg_fmt = _("Missing required config options: %(missing_options)s")
|
||||
|
||||
|
||||
class InvalidDriver(BadConfig):
|
||||
msg_fmt = _("Invalid driver: %(driver)s")
|
||||
|
||||
|
||||
class InvalidDriverOption(BadConfig):
|
||||
msg_fmt = _("Invalid driver options: %(invalid_options)s")
|
||||
|
||||
|
||||
class DatasourceNameInUse(exception.Conflict):
|
||||
msg_fmt = _("Datasource already in use with name %(value)s")
|
||||
|
||||
|
||||
class DatasourceNotFound(exception.NotFound):
|
||||
msg_fmt = _("Datasource not found %(id)s")
|
||||
|
||||
|
||||
class DriverNotFound(exception.NotFound):
|
||||
msg_fmt = _("Driver not found %(id)s")
|
||||
|
||||
|
||||
class DatasourceCreationError(BadConfig):
|
||||
msg_fmt = _("Datasource could not be created on the DSE: %(value)s")
|
||||
|
|
|
@ -172,3 +172,43 @@ class PolicyRuntimeException(CongressException):
|
|||
|
||||
class IncompleteSchemaException(CongressException):
|
||||
pass
|
||||
|
||||
|
||||
class DataServiceError (Exception):
|
||||
pass
|
||||
|
||||
|
||||
class BadConfig(BadRequest):
|
||||
pass
|
||||
|
||||
|
||||
class DatasourceDriverException(CongressException):
|
||||
pass
|
||||
|
||||
|
||||
class MissingRequiredConfigOptions(BadConfig):
|
||||
msg_fmt = _("Missing required config options: %(missing_options)s")
|
||||
|
||||
|
||||
class InvalidDriver(BadConfig):
|
||||
msg_fmt = _("Invalid driver: %(driver)s")
|
||||
|
||||
|
||||
class InvalidDriverOption(BadConfig):
|
||||
msg_fmt = _("Invalid driver options: %(invalid_options)s")
|
||||
|
||||
|
||||
class DatasourceNameInUse(Conflict):
|
||||
msg_fmt = _("Datasource already in use with name %(value)s")
|
||||
|
||||
|
||||
class DatasourceNotFound(NotFound):
|
||||
msg_fmt = _("Datasource not found %(id)s")
|
||||
|
||||
|
||||
class DriverNotFound(NotFound):
|
||||
msg_fmt = _("Driver not found %(id)s")
|
||||
|
||||
|
||||
class DatasourceCreationError(BadConfig):
|
||||
msg_fmt = _("Datasource could not be created on the DSE: %(value)s")
|
||||
|
|
|
@ -85,7 +85,7 @@ class DataSourceManager(object):
|
|||
except KeyError:
|
||||
# FIXME(arosen): we need a better exception then
|
||||
# key error being raised here
|
||||
raise DatasourceNameInUse(value=req['name'])
|
||||
raise exception.DatasourceNameInUse(value=req['name'])
|
||||
try:
|
||||
if cls.dseNode:
|
||||
cls.createservice(name=req['name'],
|
||||
|
@ -105,10 +105,10 @@ class DataSourceManager(object):
|
|||
engine.set_schema(req['name'], service.get_schema())
|
||||
except Exception:
|
||||
engine.delete_policy(req['name'])
|
||||
raise DatasourceCreationError(value=req['name'])
|
||||
raise exception.DatasourceCreationError(value=req['name'])
|
||||
|
||||
except db_exc.DBDuplicateEntry:
|
||||
raise DatasourceNameInUse(value=req['name'])
|
||||
raise exception.DatasourceNameInUse(value=req['name'])
|
||||
new_item = dict(item)
|
||||
new_item['id'] = new_id
|
||||
return cls.make_datasource_dict(new_item)
|
||||
|
@ -121,9 +121,9 @@ class DataSourceManager(object):
|
|||
obj = importutils.import_class(driver_path)
|
||||
driver = obj.get_datasource_info()
|
||||
if driver['id'] in result:
|
||||
raise BadConfig(_("There is a driver loaded already with the"
|
||||
"driver name of %s")
|
||||
% driver['id'])
|
||||
raise exception.BadConfig(_("There is a driver loaded already"
|
||||
"with the driver name of %s") %
|
||||
driver['id'])
|
||||
driver['module'] = driver_path
|
||||
result[driver['id']] = driver
|
||||
cls.loaded_drivers = result
|
||||
|
@ -179,14 +179,14 @@ class DataSourceManager(object):
|
|||
"""Return the created datasource."""
|
||||
result = datasources_db.get_datasource(id_)
|
||||
if not result:
|
||||
raise DatasourceNotFound(id=id_)
|
||||
raise exception.DatasourceNotFound(id=id_)
|
||||
return cls.make_datasource_dict(result)
|
||||
|
||||
@classmethod
|
||||
def get_driver_info(cls, driver):
|
||||
driver = cls.loaded_drivers.get(driver)
|
||||
if not driver:
|
||||
raise DriverNotFound(id=driver)
|
||||
raise exception.DriverNotFound(id=driver)
|
||||
return driver
|
||||
|
||||
@classmethod
|
||||
|
@ -199,7 +199,7 @@ class DataSourceManager(object):
|
|||
def get_datasource_schema(cls, source_id):
|
||||
datasource = datasources_db.get_datasource(source_id)
|
||||
if not datasource:
|
||||
raise DatasourceNotFound(id=source_id)
|
||||
raise exception.DatasourceNotFound(id=source_id)
|
||||
driver = cls.get_driver_info(datasource.driver)
|
||||
if driver:
|
||||
# NOTE(arosen): raises if not found
|
||||
|
@ -274,12 +274,12 @@ class DataSourceManager(object):
|
|||
except exception.DanglingReference as e:
|
||||
raise e
|
||||
except KeyError:
|
||||
raise DatasourceNotFound(id=datasource_id)
|
||||
raise exception.DatasourceNotFound(id=datasource_id)
|
||||
if update_db:
|
||||
result = datasources_db.delete_datasource(
|
||||
datasource_id, session)
|
||||
if not result:
|
||||
raise DatasourceNotFound(id=datasource_id)
|
||||
raise exception.DatasourceNotFound(id=datasource_id)
|
||||
if cls.dseNode:
|
||||
cls.dseNode.unregister_service(
|
||||
cls.dseNode.service_object(datasource['name']))
|
||||
|
@ -320,7 +320,8 @@ class DataSourceManager(object):
|
|||
# valid configuration options that the driver exposes.
|
||||
invalid_options = specified_options - valid_options
|
||||
if invalid_options:
|
||||
raise InvalidDriverOption(invalid_options=invalid_options)
|
||||
raise exception.InvalidDriverOption(
|
||||
invalid_options=invalid_options)
|
||||
|
||||
# check that all the required options are passed in
|
||||
required_options = set(
|
||||
|
@ -329,16 +330,16 @@ class DataSourceManager(object):
|
|||
missing_options = required_options - specified_options
|
||||
if missing_options:
|
||||
missing_options = ', '.join(missing_options)
|
||||
raise MissingRequiredConfigOptions(
|
||||
raise exception.MissingRequiredConfigOptions(
|
||||
missing_options=missing_options)
|
||||
return loaded_driver
|
||||
|
||||
# If we get here no datasource driver match was found.
|
||||
raise InvalidDriver(driver=req)
|
||||
raise exception.InvalidDriver(driver=req)
|
||||
|
||||
@classmethod
|
||||
def request_refresh(cls, datasource_id):
|
||||
datasource = cls.get_datasource(datasource_id)
|
||||
def request_refresh(cls, source_id):
|
||||
datasource = cls.get_datasource(source_id)
|
||||
cage = cls.dseNode or d6cage.d6Cage()
|
||||
datasource = cage.service_object(datasource['name'])
|
||||
datasource.request_refresh()
|
||||
|
@ -375,7 +376,7 @@ class DataSourceManager(object):
|
|||
# "error loading service %s: module %s does not exist",
|
||||
# name,
|
||||
# moduleName)
|
||||
raise DataServiceError(
|
||||
raise exception.DataServiceError(
|
||||
"error loading service %s: module %s does not exist" %
|
||||
(name, moduleName))
|
||||
|
||||
|
@ -397,42 +398,6 @@ class DataSourceManager(object):
|
|||
# self.log_error(
|
||||
# "Error loading service '%s' of module '%s':: \n%s",
|
||||
# name, module, traceback.format_exc())
|
||||
raise DataServiceError(
|
||||
raise exception.DataServiceError(
|
||||
"Error loading service '%s' of module '%s':: \n%s"
|
||||
% (name, module, traceback.format_exc()))
|
||||
|
||||
|
||||
class BadConfig(exception.BadRequest):
|
||||
pass
|
||||
|
||||
|
||||
class DatasourceDriverException(exception.CongressException):
|
||||
pass
|
||||
|
||||
|
||||
class MissingRequiredConfigOptions(BadConfig):
|
||||
msg_fmt = _("Missing required config options: %(missing_options)s")
|
||||
|
||||
|
||||
class InvalidDriver(BadConfig):
|
||||
msg_fmt = _("Invalid driver: %(driver)s")
|
||||
|
||||
|
||||
class InvalidDriverOption(BadConfig):
|
||||
msg_fmt = _("Invalid driver options: %(invalid_options)s")
|
||||
|
||||
|
||||
class DatasourceNameInUse(exception.Conflict):
|
||||
msg_fmt = _("Datasource already in use with name %(value)s")
|
||||
|
||||
|
||||
class DatasourceNotFound(exception.NotFound):
|
||||
msg_fmt = _("Datasource not found %(id)s")
|
||||
|
||||
|
||||
class DriverNotFound(exception.NotFound):
|
||||
msg_fmt = _("Driver not found %(id)s")
|
||||
|
||||
|
||||
class DatasourceCreationError(BadConfig):
|
||||
msg_fmt = _("Datasource could not be created on the DSE: %(value)s")
|
||||
|
|
|
@ -23,6 +23,7 @@ from oslo_config import cfg
|
|||
from congress.api import api_utils
|
||||
from congress.api import schema_model
|
||||
from congress.api import webservice
|
||||
from congress import exception
|
||||
from congress.managers import datasource as datasource_manager
|
||||
from congress.tests import base
|
||||
from congress.tests import fake_datasource
|
||||
|
@ -68,7 +69,7 @@ class TestSchemaModel(base.TestCase):
|
|||
with mock.patch.object(
|
||||
self.schema_model.datasource_mgr,
|
||||
"get_datasource_schema",
|
||||
side_effect=datasource_manager.DatasourceNotFound('invalid')
|
||||
side_effect=exception.DatasourceNotFound('invalid')
|
||||
):
|
||||
try:
|
||||
self.schema_model.get_item(None, {}, context=context)
|
||||
|
|
|
@ -54,14 +54,14 @@ class TestDataSourceManager(base.SqlTestCase):
|
|||
|
||||
def test_validate_create_datasource_invalid_driver(self):
|
||||
req = self._get_datasource_request()
|
||||
self.assertRaises(datasource_manager.InvalidDriver,
|
||||
self.assertRaises(exception.InvalidDriver,
|
||||
self.datasource_mgr.validate_create_datasource,
|
||||
req)
|
||||
|
||||
def test_validate_create_datasource_invalid_config_invalid_options(self):
|
||||
req = self._get_datasource_request()
|
||||
req['driver'] = 'invalid_datasource'
|
||||
self.assertRaises(datasource_manager.InvalidDriver,
|
||||
self.assertRaises(exception.InvalidDriver,
|
||||
self.datasource_mgr.validate_create_datasource,
|
||||
req)
|
||||
|
||||
|
@ -70,7 +70,7 @@ class TestDataSourceManager(base.SqlTestCase):
|
|||
req['driver'] = 'fake_datasource'
|
||||
# This is still missing some required options
|
||||
req['config'] = {'auth_url': '1234'}
|
||||
self.assertRaises(datasource_manager.MissingRequiredConfigOptions,
|
||||
self.assertRaises(exception.MissingRequiredConfigOptions,
|
||||
self.datasource_mgr.validate_create_datasource,
|
||||
req)
|
||||
|
||||
|
@ -163,7 +163,7 @@ class TestDataSourceManager(base.SqlTestCase):
|
|||
# let driver generate this for us.
|
||||
del req['id']
|
||||
self.datasource_mgr.add_datasource(req)
|
||||
self.assertRaises(datasource_manager.DatasourceNameInUse,
|
||||
self.assertRaises(exception.DatasourceNameInUse,
|
||||
self.datasource_mgr.add_datasource, req)
|
||||
|
||||
def test_delete_datasource(self):
|
||||
|
@ -177,7 +177,7 @@ class TestDataSourceManager(base.SqlTestCase):
|
|||
del req['id']
|
||||
result = self.datasource_mgr.add_datasource(req)
|
||||
self.datasource_mgr.delete_datasource(result['id'])
|
||||
self.assertRaises(datasource_manager.DatasourceNotFound,
|
||||
self.assertRaises(exception.DatasourceNotFound,
|
||||
self.datasource_mgr.get_datasource,
|
||||
result['id'])
|
||||
engine = self.cage.service_object('engine')
|
||||
|
@ -204,7 +204,7 @@ class TestDataSourceManager(base.SqlTestCase):
|
|||
result['id'])
|
||||
|
||||
def test_delete_invalid_datasource(self):
|
||||
self.assertRaises(datasource_manager.DatasourceNotFound,
|
||||
self.assertRaises(exception.DatasourceNotFound,
|
||||
self.datasource_mgr.delete_datasource,
|
||||
"does_not_exist")
|
||||
|
||||
|
@ -216,7 +216,7 @@ class TestDataSourceManager(base.SqlTestCase):
|
|||
fake_datasource.FakeDataSource.get_schema())
|
||||
|
||||
def test_get_datasouce_schema_driver_not_found(self):
|
||||
self.assertRaises(datasource_manager.DatasourceNotFound,
|
||||
self.assertRaises(exception.DatasourceNotFound,
|
||||
self.datasource_mgr.get_datasource_schema,
|
||||
"does_not_exist")
|
||||
|
||||
|
@ -227,7 +227,7 @@ class TestDataSourceManager(base.SqlTestCase):
|
|||
['congress.tests.fake_datasource.FakeDataSource',
|
||||
'congress.tests.fake_datasource.FakeDataSource'])
|
||||
self.datasource_mgr = datasource_manager.DataSourceManager
|
||||
self.assertRaises(datasource_manager.BadConfig,
|
||||
self.assertRaises(exception.BadConfig,
|
||||
self.datasource_mgr.validate_configured_drivers)
|
||||
|
||||
def test_datasource_spawn_datasource_poll(self):
|
||||
|
@ -244,6 +244,6 @@ class TestDataSourceManager(base.SqlTestCase):
|
|||
# TODO(thinrichs): test that the driver actually polls
|
||||
|
||||
def test_datasource_spawn_datasource_poll_not_found(self):
|
||||
self.assertRaises(datasource_manager.DatasourceNotFound,
|
||||
self.assertRaises(exception.DatasourceNotFound,
|
||||
self.datasource_mgr.request_refresh,
|
||||
"does_not_exist")
|
||||
|
|
|
@ -129,7 +129,7 @@ class TestDataSource(base.SqlTestCase):
|
|||
def test_create_datasource_duplicate_name(self):
|
||||
req = self._get_datasource_request()
|
||||
self.dseNode.add_datasource(req)
|
||||
self.assertRaises(dse_node.DatasourceNameInUse,
|
||||
self.assertRaises(congressException.DatasourceNameInUse,
|
||||
self.dseNode.add_datasource, req)
|
||||
|
||||
def test_delete_datasource(self):
|
||||
|
@ -166,7 +166,7 @@ class TestDataSource(base.SqlTestCase):
|
|||
# result['id'])
|
||||
|
||||
def test_delete_invalid_datasource(self):
|
||||
self.assertRaises(dse_node.DatasourceNotFound,
|
||||
self.assertRaises(congressException.DatasourceNotFound,
|
||||
self.dseNode.delete_datasource,
|
||||
"does_not_exist")
|
||||
|
||||
|
@ -184,5 +184,5 @@ class TestDataSource(base.SqlTestCase):
|
|||
'drivers',
|
||||
['congress.tests.fake_datasource.FakeDataSource',
|
||||
'congress.tests.fake_datasource.FakeDataSource'])
|
||||
self.assertRaises(dse_node.BadConfig,
|
||||
self.assertRaises(congressException.BadConfig,
|
||||
self.dseNode.load_drivers)
|
||||
|
|
|
@ -64,14 +64,14 @@ class TestDataSourceManager(base.SqlTestCase):
|
|||
|
||||
def test_validate_create_datasource_invalid_driver(self):
|
||||
req = self._get_datasource_request()
|
||||
self.assertRaises(datasource_manager.InvalidDriver,
|
||||
self.assertRaises(exception.InvalidDriver,
|
||||
self.datasource_mgr.validate_create_datasource,
|
||||
req)
|
||||
|
||||
def test_validate_create_datasource_invalid_config_invalid_options(self):
|
||||
req = self._get_datasource_request()
|
||||
req['driver'] = 'invalid_datasource'
|
||||
self.assertRaises(datasource_manager.InvalidDriver,
|
||||
self.assertRaises(exception.InvalidDriver,
|
||||
self.datasource_mgr.validate_create_datasource,
|
||||
req)
|
||||
|
||||
|
@ -80,7 +80,7 @@ class TestDataSourceManager(base.SqlTestCase):
|
|||
req['driver'] = 'fake_datasource'
|
||||
# This is still missing some required options
|
||||
req['config'] = {'auth_url': '1234'}
|
||||
self.assertRaises(datasource_manager.MissingRequiredConfigOptions,
|
||||
self.assertRaises(exception.MissingRequiredConfigOptions,
|
||||
self.datasource_mgr.validate_create_datasource,
|
||||
req)
|
||||
|
||||
|
@ -173,7 +173,7 @@ class TestDataSourceManager(base.SqlTestCase):
|
|||
# let driver generate this for us.
|
||||
del req['id']
|
||||
self.datasource_mgr.add_datasource(req)
|
||||
self.assertRaises(datasource_manager.DatasourceNameInUse,
|
||||
self.assertRaises(exception.DatasourceNameInUse,
|
||||
self.datasource_mgr.add_datasource, req)
|
||||
|
||||
# TODO(dse2): need to implement dseNode.unregister_service to enable
|
||||
|
@ -217,7 +217,7 @@ class TestDataSourceManager(base.SqlTestCase):
|
|||
result['id'])
|
||||
|
||||
def test_delete_invalid_datasource(self):
|
||||
self.assertRaises(datasource_manager.DatasourceNotFound,
|
||||
self.assertRaises(exception.DatasourceNotFound,
|
||||
self.datasource_mgr.delete_datasource,
|
||||
"does_not_exist")
|
||||
|
||||
|
@ -229,7 +229,7 @@ class TestDataSourceManager(base.SqlTestCase):
|
|||
fake_datasource.FakeDataSource.get_schema())
|
||||
|
||||
def test_get_datasouce_schema_driver_not_found(self):
|
||||
self.assertRaises(datasource_manager.DatasourceNotFound,
|
||||
self.assertRaises(exception.DatasourceNotFound,
|
||||
self.datasource_mgr.get_datasource_schema,
|
||||
"does_not_exist")
|
||||
|
||||
|
@ -240,7 +240,7 @@ class TestDataSourceManager(base.SqlTestCase):
|
|||
['congress.tests.fake_datasource.FakeDataSource',
|
||||
'congress.tests.fake_datasource.FakeDataSource'])
|
||||
self.datasource_mgr = datasource_manager.DataSourceManager
|
||||
self.assertRaises(datasource_manager.BadConfig,
|
||||
self.assertRaises(exception.BadConfig,
|
||||
self.datasource_mgr.validate_configured_drivers)
|
||||
|
||||
def test_datasource_spawn_datasource_poll(self):
|
||||
|
@ -257,6 +257,6 @@ class TestDataSourceManager(base.SqlTestCase):
|
|||
# TODO(thinrichs): test that the driver actually polls
|
||||
|
||||
def test_datasource_spawn_datasource_poll_not_found(self):
|
||||
self.assertRaises(datasource_manager.DatasourceNotFound,
|
||||
self.assertRaises(exception.DatasourceNotFound,
|
||||
self.datasource_mgr.request_refresh,
|
||||
"does_not_exist")
|
||||
|
|
Loading…
Reference in New Issue