Ussuri unit test failures

Bug #1872514 reported by Corey Bryant
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
networking-bgpvpn
Fix Released
Undecided
Corey Bryant

Bug Description

I'm getting several unit test failures for bgpvpn on ussuri with the latest neutron source.

Sample of test failure:

{3} networking_bgpvpn.tests.unit.db.test_db.BgpvpnDBTestCase.test_bgpvpn_create_update_delete [0.003005s] ... FAILED

Captured traceback:
~~~~~~~~~~~~~~~~~~~
    Traceback (most recent call last):

      File "/<<PKGBUILDDIR>>/networking_bgpvpn/tests/unit/db/test_db.py", line 37, in setUp
    super(BgpvpnDBTestCase, self).setUp(service_provider)

      File "/<<PKGBUILDDIR>>/networking_bgpvpn/tests/unit/services/test_plugin.py", line 98, in setUp
    {bgpvpn_def.ALIAS: plugin.BGPVPNPlugin(),

      File "/<<PKGBUILDDIR>>/networking_bgpvpn/neutron/services/plugin.py", line 59, in __init__
    pconf.ProviderConfiguration('networking_bgpvpn'))

      File "/usr/lib/python3/dist-packages/neutron/services/provider_configuration.py", line 222, in __init__
    for prov in parse_service_provider_opt(svc_module, svc_type):

      File "/usr/lib/python3/dist-packages/neutron/services/provider_configuration.py", line 169, in parse_service_provider_opt
    svc_providers_opt = neutron_mod.service_providers()

      File "/usr/lib/python3/dist-packages/neutron/services/provider_configuration.py", line 118, in service_providers
    providers = self.ini().service_providers.service_provider

      File "/usr/lib/python3/dist-packages/neutron/services/provider_configuration.py", line 95, in ini
    ini_file(args=list(itertools.chain.from_iterable(

      File "/usr/lib/python3/dist-packages/oslo_config/cfg.py", line 2136, in __call__
    raise ConfigFilesPermissionDeniedError(

    oslo_config.cfg.ConfigFilesPermissionDeniedError: Failed to open some config files: /etc/neutron/networking_bgpvpn.conf

Tags: unittest
Revision history for this message
Lajos Katona (lajos-katona) wrote :

With py36 and latest neutron and neutron-lib I got a different error:
=========================
Failures during discovery
=========================
--- import errors ---
Failed to import test module: networking_bgpvpn.tests.unit.services.bagpipe.test_bagpipe
Traceback (most recent call last):
  File "/usr/lib/python3.6/unittest/loader.py", line 428, in _find_test_path
    module = self._get_module_from_name(name)
  File "/usr/lib/python3.6/unittest/loader.py", line 369, in _get_module_from_name
    __import__(name)
  File "/home/lajoskatona/networking-bgpvpn/networking_bgpvpn/tests/unit/services/bagpipe/test_bagpipe.py", line 35, in <module>
    from networking_bgpvpn.neutron.services.service_drivers.bagpipe import bagpipe
  File "/home/lajoskatona/networking-bgpvpn/networking_bgpvpn/neutron/services/service_drivers/bagpipe/bagpipe.py", line 37, in <module>
    from networking_bgpvpn.neutron.services.service_drivers.bagpipe \
  File "/home/lajoskatona/networking-bgpvpn/networking_bgpvpn/neutron/services/service_drivers/bagpipe/bagpipe_v2.py", line 31, in <module>
    from networking_bagpipe.objects import bgpvpn as bgpvpn_objects
  File "/home/lajoskatona/networking-bgpvpn/.tox/py36/lib/python3.6/site-packages/networking_bagpipe/objects/bgpvpn.py", line 22, in <module>
    from neutron.objects import common_types
ImportError: cannot import name 'common_types'

So something is in the air.... I check it

tags: added: unittest
Changed in bgpvpn:
status: New → Confirmed
assignee: nobody → Lajos Katona (lajos-katona)
Revision history for this message
Lajos Katona (lajos-katona) wrote :

If I fetch latest networking-bgpvpn and use latest neutron, neutron-lib and networking-bagpipe I have no issues with unittests on py36 & py37 at least.

Revision history for this message
Corey Bryant (corey.bryant) wrote :

Hi Lajos, this must be something on my end then. I have all the latest of those but must be something else that's different. Feel free to close and thanks for taking a look.

Revision history for this message
Lajos Katona (lajos-katona) wrote :

Hi, I double checked to be sure, but for me with latest neutron, neutron-lib and networking-bagpipe unittests passed.
If you see similar things don't hesitate :-)

Changed in bgpvpn:
status: Confirmed → Invalid
Revision history for this message
Corey Bryant (corey.bryant) wrote :

Ok so the problem is that when we run unit tests in the ubuntu package they end up attempting to access /etc/neutron/networking_bgpvpn.conf but fail with permission denied (as can be seen in the test failure posted to this bug). The failure makes sense because we've tightened up access to during the ussuri release and the builds run under a non-root build user (not neutron or root). Do you know by any chance if there's a way to keep these tests from attempting to access /etc/neutron? Maybe there is a mock missing?

Revision history for this message
Lajos Katona (lajos-katona) wrote :

This part seems suspicious:
https://opendev.org/openstack/networking-bgpvpn/src/commit/d6a93f62337ffd4db88337b627008c6d9a7d276e/networking_bgpvpn/neutron/services/plugin.py#L54-L71

I check that later.
The strange is that if I run locally the tests I have no /etc/neutron/.... folder/files.

Revision history for this message
Corey Bryant (corey.bryant) wrote :

Yes! I also noticed when run with tox that there doesn't appear to be any /etc/neutron to access. Maybe add_provider_configuration can be mocked out.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to networking-bgpvpn (master)

Fix proposed to branch: master
Review: https://review.opendev.org/722308

Changed in bgpvpn:
status: Invalid → In Progress
Changed in bgpvpn:
assignee: Lajos Katona (lajos-katona) → Corey Bryant (corey.bryant)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to networking-bgpvpn (master)

Reviewed: https://review.opendev.org/722308
Committed: https://git.openstack.org/cgit/openstack/networking-bgpvpn/commit/?id=b5d51d0575208ddd161b94f2f3d5168407839859
Submitter: Zuul
Branch: master

commit b5d51d0575208ddd161b94f2f3d5168407839859
Author: Corey Bryant <email address hidden>
Date: Thu Apr 23 14:40:37 2020 -0400

    mock out ProviderConfiguration.__init__

    In some environments unit tests fails due to tests attempting to
    access /etc/neutron/ and not having permission to do so. Let's
    mock out add_provider_configuration to avoid this behaviour in
    unit test environment.

    Change-Id: If385c26e4a6bd9eca5bd873df4d25a2d888dd9a9
    Closes-Bug: #1872514

Changed in bgpvpn:
status: In Progress → Fix Released
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.