test_l3_plugin fails when run as single test

Bug #1350252 reported by Isaku Yamahata
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Low
Isaku Yamahata

Bug Description

tox -e py27 neutron.tests.unit.test_l3_plugin
fails as follows. This is bacause necessary oslo config isn't initialized properly by L3AgentDbIntTestCase and L3AgentDbSepTestCase

The error log follows.
 $ tox -e py27 neutron.tests.unit.test_l3_plugin
py27 develop-inst-nodeps: /home/yamahata/openstack/tacker/neutron-l3-plugin/upstream/neutron-l3-db-refacotr-0
py27 runtests: commands[0] | python -m neutron.openstack.common.lockutils python setup.py testr --slowest --testr-args=neutron.tests.unit.test_l3_plugin
running testr
running=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 OS_LOG_CAPTURE=1 ${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./neutron/tests/unit} --list
running=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 OS_LOG_CAPTURE=1 ${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./neutron/tests/unit} --load-list /tmp/tmpNLNI_l
running=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 OS_LOG_CAPTURE=1 ${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./neutron/tests/unit} --load-list /tmp/tmpBl_vq6
running=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 OS_LOG_CAPTURE=1 ${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./neutron/tests/unit} --load-list /tmp/tmpO3NkaL
running=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 OS_LOG_CAPTURE=1 ${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./neutron/tests/unit} --load-list /tmp/tmpc3FrWL
running=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 OS_LOG_CAPTURE=1 ${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./neutron/tests/unit} --load-list /tmp/tmppz6MIP
running=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 OS_LOG_CAPTURE=1 ${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./neutron/tests/unit} --load-list /tmp/tmprcHfnW
running=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 OS_LOG_CAPTURE=1 ${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./neutron/tests/unit} --load-list /tmp/tmpVW99Uk
running=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 OS_LOG_CAPTURE=1 ${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./neutron/tests/unit} --load-list /tmp/tmpMC3U19
running=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 OS_LOG_CAPTURE=1 ${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./neutron/tests/unit} --load-list /tmp/tmpiqP4jI
running=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 OS_LOG_CAPTURE=1 ${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./neutron/tests/unit} --load-list /tmp/tmpK6j9JS
running=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 OS_LOG_CAPTURE=1 ${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./neutron/tests/unit} --load-list /tmp/tmp_cFhYl
running=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 OS_LOG_CAPTURE=1 ${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./neutron/tests/unit} --load-list /tmp/tmpNXI0Mi
======================================================================
FAIL:
neutron.tests.unit.test_l3_plugin.L3AgentDbSepTestCase.test_l3_agent_routers_query_floatingips
tags: worker-10
----------------------------------------------------------------------
Traceback (most recent call last):
  File "neutron/tests/unit/test_l3_plugin.py", line 2073, in setUp
    self.core_plugin = TestNoL3NatPlugin()
  File "neutron/db/db_base_plugin_v2.py", line 72, in __init__
    db.configure_db()
  File "neutron/db/api.py", line 45, in configure_db
    register_models()
  File "neutron/db/api.py", line 68, in register_models
    facade = _create_facade_lazily()
  File "neutron/db/api.py", line 34, in _create_facade_lazily
    _FACADE = session.EngineFacade.from_config(cfg.CONF, sqlite_fk=True)
  File "/neutron/.tox/py27/local/lib/python2.7/site-packages/oslo/db/sqlalchemy/session.py", line 977, in from_config
    retry_interval=conf.database.retry_interval)
  File "/neutron/.tox/py27/local/lib/python2.7/site-packages/oslo/db/sqlalchemy/session.py", line 893, in __init__
    **engine_kwargs)
  File "/neutron/.tox/py27/local/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'
======================================================================
FAIL: neutron.tests.unit.test_l3_plugin.L3AgentDbSepTestCase.test_router_gateway_op_agent
tags: worker-10
----------------------------------------------------------------------
Traceback (most recent call last):
  File "neutron/tests/unit/test_l3_plugin.py", line 2073, in setUp
    self.core_plugin = TestNoL3NatPlugin()
  File "neutron/db/db_base_plugin_v2.py", line 72, in __init__
    db.configure_db()
  File "neutron/db/api.py", line 45, in configure_db
    register_models()
  File "neutron/db/api.py", line 68, in register_models
    facade = _create_facade_lazily()
  File "neutron/db/api.py", line 34, in _create_facade_lazily
    _FACADE = session.EngineFacade.from_config(cfg.CONF, sqlite_fk=True)
  File "/neutron/.tox/py27/local/lib/python2.7/site-packages/oslo/db/sqlalchemy/session.py", line 977, in from_config
    retry_interval=conf.database.retry_interval)
  File "/neutron/.tox/py27/local/lib/python2.7/site-packages/oslo/db/sqlalchemy/session.py", line 893, in __init__
    **engine_kwargs)
  File "/neutron/.tox/py27/local/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'
======================================================================
FAIL: neutron.tests.unit.test_l3_plugin.L3AgentDbIntTestCase.test_l3_agent_routers_query_floatingips
tags: worker-1
----------------------------------------------------------------------
Traceback (most recent call last):
  File "neutron/tests/unit/test_l3_plugin.py", line 2060, in setUp
    self.core_plugin = TestL3NatIntPlugin()
  File "neutron/db/db_base_plugin_v2.py", line 72, in __init__
    db.configure_db()
  File "neutron/db/api.py", line 45, in configure_db
    register_models()
  File "neutron/db/api.py", line 68, in register_models
    facade = _create_facade_lazily()
  File "neutron/db/api.py", line 34, in _create_facade_lazily
    _FACADE = session.EngineFacade.from_config(cfg.CONF, sqlite_fk=True)
  File "/neutron/.tox/py27/local/lib/python2.7/site-packages/oslo/db/sqlalchemy/session.py", line 977, in from_config
    retry_interval=conf.database.retry_interval)
  File "/neutron/.tox/py27/local/lib/python2.7/site-packages/oslo/db/sqlalchemy/session.py", line 893, in __init__
    **engine_kwargs)
  File "/neutron/.tox/py27/local/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'
======================================================================
FAIL: neutron.tests.unit.test_l3_plugin.L3AgentDbSepTestCase.test_l3_agent_routers_query_ignore_interfaces_with_moreThanOneIp
tags: worker-1
----------------------------------------------------------------------
Traceback (most recent call last):
  File "neutron/tests/unit/test_l3_plugin.py", line 2073, in setUp
    self.core_plugin = TestNoL3NatPlugin()
  File "neutron/db/db_base_plugin_v2.py", line 72, in __init__
    db.configure_db()
  File "neutron/db/api.py", line 45, in configure_db
    register_models()
  File "neutron/db/api.py", line 68, in register_models
    facade = _create_facade_lazily()
  File "neutron/db/api.py", line 34, in _create_facade_lazily
    _FACADE = session.EngineFacade.from_config(cfg.CONF, sqlite_fk=True)
  File "/neutron/.tox/py27/local/lib/python2.7/site-packages/oslo/db/sqlalchemy/session.py", line 977, in from_config
    retry_interval=conf.database.retry_interval)
  File "/neutron/.tox/py27/local/lib/python2.7/site-packages/oslo/db/sqlalchemy/session.py", line 893, in __init__
    **engine_kwargs)
  File "/neutron/.tox/py27/local/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'
======================================================================
FAIL: process-returncode
tags: worker-10
----------------------------------------------------------------------
Binary content:
  traceback (test/plain; charset="utf8")
======================================================================
FAIL: process-returncode
tags: worker-1
----------------------------------------------------------------------
Binary content:
  traceback (test/plain; charset="utf8")
Ran 304 (-13543) tests in 27.382s (-600.855s)
FAILED (id=17, failures=6 (-2))
error: testr failed (1)
ERROR: InvocationError: '/neutron/.tox/py27/bin/python -m neutron.openstack.common.lockutils python setup.py testr --slowest --testr-args=neutron.tests.unit.test_l3_plugin'
__________________________________________________________________ summary __________________________________________________________________
ERROR: py27: commands failed

Tags: unittest
description: updated
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

Fix proposed to branch: master
Review: https://review.openstack.org/110577

Changed in neutron:
assignee: nobody → Isaku Yamahata (yamahata)
status: New → In Progress
Revision history for this message
Kevin Benton (kevinbenton) wrote :
Revision history for this message
Isaku Yamahata (yamahata) wrote :

Unfortunately 108544 doesn't fix it. Because the setUp() methods of the two classes are something like
def setUp()
  instantiate service plugin ===> it requires config initialized
  super().setUp() <=== 108544 initializes

Revision history for this message
Kevin Benton (kevinbenton) wrote :

Right, my mistake. I think if you can change the order that would work best so you don't have to block the config setup in the base now.

Akihiro Motoki (amotoki)
Changed in neutron:
importance: Undecided → Low
milestone: none → juno-3
tags: added: unittest
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.openstack.org/110577
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=748d4fdaf62667f39ce65e5053792b54dd684698
Submitter: Jenkins
Branch: master

commit 748d4fdaf62667f39ce65e5053792b54dd684698
Author: Isaku Yamahata <email address hidden>
Date: Wed Jul 30 18:07:04 2014 +0900

    test_l3_plugin: L3AgentDbInteTestCase L3AgentDbSepTestCase fails

    L3AgentDbInteTestCase and L3AgentDbSepTestCase fails when they are run
    independently without other test case. something like
    tox -e py27 neutron.tests.unit.test_l3_plugin
    It's because necessary oslo.config options aren't properly initialized
    when instantiating service plugin.
    Initialize config before instantiating plugin.

    Change-Id: Ic6dd28e3caf8b9e3322bf2df99e67adb138cb234
    Closes-Bug: #1350252

Changed in neutron:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in neutron:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in neutron:
milestone: juno-3 → 2014.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.