← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1346673] Re: fixtures in neutron.tests.base blow away default database config

 

** Changed in: neutron
       Status: Fix Committed => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1346673

Title:
  fixtures in neutron.tests.base blow away default database config

Status in OpenStack Neutron (virtual network service):
  Fix Released

Bug description:
  Really trying to narrow this one down fully, and just putting this up
  because this is as far as I've gotten.

  Basically, the lines in neutron/tests/base.py:

    line 159:        self.addCleanup(CONF.reset)
    line 182:    self.useFixture(self.messaging_conf)

  cause cfg.CONF to get totally wiped out in the "database" config.  I
  don't yet understand why this is the case.

  if you then run any test that extends BaseTestCase, and then run
  neutron/tests/unit/test_db_plugin.py ->
  NeutronDbPluginV2AsMixinTestCase in the same process, these two tests
  fail:

  Traceback (most recent call last):
    File "/Users/classic/dev/redhat/openstack/neutron/neutron/tests/unit/test_db_plugin.py", line 3943, in setUp
      self.plugin = importutils.import_object(DB_PLUGIN_KLASS)
    File "/Users/classic/dev/redhat/openstack/neutron/neutron/openstack/common/importutils.py", line 38, in import_object
      return import_class(import_str)(*args, **kwargs)
    File "/Users/classic/dev/redhat/openstack/neutron/neutron/db/db_base_plugin_v2.py", line 72, in __init__
      db.configure_db()
    File "/Users/classic/dev/redhat/openstack/neutron/neutron/db/api.py", line 45, in configure_db
      register_models()
    File "/Users/classic/dev/redhat/openstack/neutron/neutron/db/api.py", line 68, in register_models
      facade = _create_facade_lazily()
    File "/Users/classic/dev/redhat/openstack/neutron/neutron/db/api.py", line 34, in _create_facade_lazily
      _FACADE = session.EngineFacade.from_config(cfg.CONF, sqlite_fk=True)
    File "/Users/classic/dev/redhat/openstack/neutron/.tox/py27/lib/python2.7/site-packages/oslo/db/sqlalchemy/session.py", line 977, in from_config
      retry_interval=conf.database.retry_interval)
    File "/Users/classic/dev/redhat/openstack/neutron/.tox/py27/lib/python2.7/site-packages/oslo/db/sqlalchemy/session.py", line 893, in __init__
      **engine_kwargs)
    File "/Users/classic/dev/redhat/openstack/neutron/.tox/py27/lib/python2.7/site-packages/oslo/db/sqlalchemy/session.py", line 650, in create_engine
      if "sqlite" in connection_dict.drivername:
  AttributeError: 'NoneType' object has no attribute 'drivername'

  I'm getting this error running tox on a subset of tests, however it's
  difficult to reproduce as the subprocesses have to work out just
  right.

  To reproduce, just install nose and do:

  .tox/py27/bin/nosetests -v
  neutron.tests.unit.test_db_plugin:DbModelTestCase
  neutron.tests.unit.test_db_plugin:NeutronDbPluginV2AsMixinTestCase

  That is, DbModelTestCase is a harmless test but because it runs
  base.BaseTestCase first, cfg.CONF gets blown away.

  I don't know what the solution should be here, cfg.CONF shouldn't be
  reset but I don't know what "messaging_conffixture.ConfFixture" is or
  how "CONF.reset" was supposed to work as it blows away DB config.  The
  cfg.CONF in the first place seems to get set up via this path:

    <string>(7)exec2()
    /Users/classic/dev/redhat/openstack/neutron/neutron/tests/unit/test_db_plugin.py(26)<module>()
  -> from neutron.api import extensions
    /Users/classic/dev/redhat/openstack/neutron/neutron/api/extensions.py(31)<module>()
  -> from neutron import manager
    /Users/classic/dev/redhat/openstack/neutron/neutron/manager.py(20)<module>()
  -> from neutron.common import rpc as n_rpc
    /Users/classic/dev/redhat/openstack/neutron/neutron/common/rpc.py(22)<module>()
  -> from neutron import context
    /Users/classic/dev/redhat/openstack/neutron/neutron/context.py(26)<module>()
  -> from neutron import policy
    /Users/classic/dev/redhat/openstack/neutron/neutron/policy.py(55)<module>()
  -> cfg.CONF.import_opt('policy_file', 'neutron.common.config')
    /Users/classic/dev/redhat/openstack/neutron/.tox/py27/lib/python2.7/site-packages/oslo/config/cfg.py(1764)import_opt()
  -> __import__(module_str)
    /Users/classic/dev/redhat/openstack/neutron/neutron/common/config.py(135)<module>()
  -> max_overflow=20, pool_timeout=10)
  > /Users/classic/dev/redhat/openstack/neutron/.tox/py27/lib/python2.7/site-packages/oslo/db/options.py(145)set_defaults()
  -> conf.register_opts(database_opts, group='database')

  e.g. oslo.db set_defaults() sets it up.

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1346673/+subscriptions


References