diff --git a/neutron/common/config.py b/neutron/common/config.py index c8e4eebf52c..9911dd69cf0 100644 --- a/neutron/common/config.py +++ b/neutron/common/config.py @@ -152,13 +152,18 @@ cfg.CONF.register_cli_opts(core_cli_opts) # Ensure that the control exchange is set correctly oslo_messaging.set_transport_defaults(control_exchange='neutron') -_SQL_CONNECTION_DEFAULT = 'sqlite://' -# Update the default QueuePool parameters. These can be tweaked by the -# configuration variables - max_pool_size, max_overflow and pool_timeout -db_options.set_defaults(cfg.CONF, - connection=_SQL_CONNECTION_DEFAULT, - sqlite_db='', max_pool_size=10, - max_overflow=20, pool_timeout=10) + + +def set_db_defaults(): + # Update the default QueuePool parameters. These can be tweaked by the + # conf variables - max_pool_size, max_overflow and pool_timeout + db_options.set_defaults( + cfg.CONF, + connection='sqlite://', + sqlite_db='', max_pool_size=10, + max_overflow=20, pool_timeout=10) + +set_db_defaults() NOVA_CONF_SECTION = 'nova' diff --git a/neutron/tests/base.py b/neutron/tests/base.py index d89be686bf5..cb5fb3ee66f 100644 --- a/neutron/tests/base.py +++ b/neutron/tests/base.py @@ -127,6 +127,11 @@ class DietTestCase(testtools.TestCase): def setUp(self): super(DietTestCase, self).setUp() + # FIXME(amuller): this must be called in the Neutron unit tests base + # class to initialize the DB connection string. Moving this may cause + # non-deterministic failures. Bug #1489098 for more info. + config.set_db_defaults() + # Configure this first to ensure pm debugging support for setUp() debugger = os.environ.get('OS_POST_MORTEM_DEBUGGER') if debugger: