Merge "Start metadata agent without trying to connect db"
This commit is contained in:
@@ -36,5 +36,7 @@ def main():
|
|||||||
config.init(sys.argv[1:])
|
config.init(sys.argv[1:])
|
||||||
config.setup_logging()
|
config.setup_logging()
|
||||||
utils.log_opt_values(LOG)
|
utils.log_opt_values(LOG)
|
||||||
|
# metadata agent need not connect DB
|
||||||
|
cfg.CONF.set_override("connection", "", "database")
|
||||||
proxy = agent.UnixDomainMetadataProxy(cfg.CONF)
|
proxy = agent.UnixDomainMetadataProxy(cfg.CONF)
|
||||||
proxy.run()
|
proxy.run()
|
||||||
|
@@ -585,6 +585,8 @@ class TestUnixDomainMetadataProxy(base.BaseTestCase):
|
|||||||
mock.call(cfg.CONF),
|
mock.call(cfg.CONF),
|
||||||
mock.call().run()]
|
mock.call().run()]
|
||||||
)
|
)
|
||||||
|
cfg.CONF.set_override.assert_called_once_with(
|
||||||
|
"connection", "", "database")
|
||||||
|
|
||||||
def test_init_state_reporting(self):
|
def test_init_state_reporting(self):
|
||||||
with mock.patch('os.makedirs'):
|
with mock.patch('os.makedirs'):
|
||||||
|
@@ -49,6 +49,23 @@ def open_no_proxy(*args, **kwargs):
|
|||||||
return opener.open(*args, **kwargs)
|
return opener.open(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
class TestWorkerService(base.BaseTestCase):
|
||||||
|
"""WorkerService tests."""
|
||||||
|
|
||||||
|
@mock.patch('neutron.db.api')
|
||||||
|
def test_start_withoutdb_call(self, apimock):
|
||||||
|
_service = mock.Mock()
|
||||||
|
_service.pool = mock.Mock()
|
||||||
|
_service.pool.spawn = mock.Mock()
|
||||||
|
_service.pool.spawn.return_value = None
|
||||||
|
|
||||||
|
_app = mock.Mock()
|
||||||
|
cfg.CONF.set_override("connection", "", "database")
|
||||||
|
workerservice = wsgi.WorkerService(_service, _app)
|
||||||
|
workerservice.start()
|
||||||
|
self.assertFalse(apimock.get_engine.called)
|
||||||
|
|
||||||
|
|
||||||
class TestWSGIServer(base.BaseTestCase):
|
class TestWSGIServer(base.BaseTestCase):
|
||||||
"""WSGI server tests."""
|
"""WSGI server tests."""
|
||||||
|
|
||||||
|
@@ -99,8 +99,9 @@ class WorkerService(object):
|
|||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
# We may have just forked from parent process. A quick disposal of the
|
# We may have just forked from parent process. A quick disposal of the
|
||||||
# existing sql connections avoids producting 500 errors later when they
|
# existing sql connections avoids producing 500 errors later when they
|
||||||
# are discovered to be broken.
|
# are discovered to be broken.
|
||||||
|
if CONF.database.connection:
|
||||||
api.get_engine().pool.dispose()
|
api.get_engine().pool.dispose()
|
||||||
self._server = self._service.pool.spawn(self._service._run,
|
self._server = self._service.pool.spawn(self._service._run,
|
||||||
self._application,
|
self._application,
|
||||||
|
Reference in New Issue
Block a user