← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1978564] Re: Unit tests fail with latest pyroute2 releases

 

Reviewed:  https://review.opendev.org/c/openstack/neutron/+/845715
Committed: https://opendev.org/openstack/neutron/commit/d01700034ac80631893215e742de44cb903ba2a3
Submitter: "Zuul (22348)"
Branch:    master

commit d01700034ac80631893215e742de44cb903ba2a3
Author: Dr. Jens Harbott <harbott@xxxxxxxxxx>
Date:   Tue Jun 14 11:21:10 2022 +0200

    Fix tests involving pyroute2.netlink module
    
    pyroute2 0.6.11 did some further refactoring of their module imports,
    so using pyroute2.netlink.some_func() doesn't work anymore. Since we
    do "from pyroute2 import netlink" anyway, use the imported module
    everywhere.
    
    Also, mock.patch()ing pyroute2.netlink.rtnl.tcmsg.common.tick_in_usec
    doesn't work anymore, but also doesn't seem to be necessary for the
    tests to succeed, so just drop it.
    
    Closes-Bug: 1978564
    Change-Id: Ie06b987f7efbff8057293893e42bee7b682b9ba1


** Changed in: neutron
       Status: In Progress => 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/1978564

Title:
  Unit tests fail with latest pyroute2 releases

Status in neutron:
  Fix Released

Bug description:
  With the latest pyroute2 releases, import handling has changed again,
  causing some unit tests to fail.

  https://zuul.opendev.org/t/openstack/build/c217d83a69664925aad47be4398f5b9a

  2022-06-14 03:53:43.007328 | ubuntu-focal | ==============================
  2022-06-14 03:53:43.007340 | ubuntu-focal | Failed 3 tests - output below:
  2022-06-14 03:53:43.007351 | ubuntu-focal | ==============================
  2022-06-14 03:53:43.007363 | ubuntu-focal |
  2022-06-14 03:53:43.007374 | ubuntu-focal | neutron.tests.unit.agent.linux.test_tc_lib.TcTestCase.test_list_tc_qdiscs_tbf
  2022-06-14 03:53:43.007409 | ubuntu-focal | -----------------------------------------------------------------------------
  2022-06-14 03:53:43.007420 | ubuntu-focal |
  2022-06-14 03:53:43.007431 | ubuntu-focal | Captured traceback:
  2022-06-14 03:53:43.007445 | ubuntu-focal | ~~~~~~~~~~~~~~~~~~~
  2022-06-14 03:53:43.007456 | ubuntu-focal |     Traceback (most recent call last):
  2022-06-14 03:53:43.007475 | ubuntu-focal |
  2022-06-14 03:53:43.007486 | ubuntu-focal |       File "/usr/lib/python3.8/unittest/mock.py", line 1215, in _dot_lookup
  2022-06-14 03:53:43.007496 | ubuntu-focal |     return getattr(thing, comp)
  2022-06-14 03:53:43.007507 | ubuntu-focal |
  2022-06-14 03:53:43.007517 | ubuntu-focal |     AttributeError: module 'pyroute2' has no attribute 'netlink'
  2022-06-14 03:53:43.007532 | ubuntu-focal |
  2022-06-14 03:53:43.007544 | ubuntu-focal |
  2022-06-14 03:53:43.007555 | ubuntu-focal | During handling of the above exception, another exception occurred:
  2022-06-14 03:53:43.007566 | ubuntu-focal |
  2022-06-14 03:53:43.007576 | ubuntu-focal |
  2022-06-14 03:53:43.007586 | ubuntu-focal |     Traceback (most recent call last):
  2022-06-14 03:53:43.007597 | ubuntu-focal |
  2022-06-14 03:53:43.007607 | ubuntu-focal |       File "/home/zuul/src/opendev.org/openstack/neutron/neutron/tests/base.py", line 182, in func
  2022-06-14 03:53:43.007618 | ubuntu-focal |     return f(self, *args, **kwargs)
  2022-06-14 03:53:43.007628 | ubuntu-focal |
  2022-06-14 03:53:43.007639 | ubuntu-focal |       File "/usr/lib/python3.8/unittest/mock.py", line 1322, in patched
  2022-06-14 03:53:43.007649 | ubuntu-focal |     with self.decoration_helper(patched,
  2022-06-14 03:53:43.007660 | ubuntu-focal |
  2022-06-14 03:53:43.007670 | ubuntu-focal |       File "/usr/lib/python3.8/contextlib.py", line 113, in __enter__
  2022-06-14 03:53:43.007681 | ubuntu-focal |     return next(self.gen)
  2022-06-14 03:53:43.007698 | ubuntu-focal |
  2022-06-14 03:53:43.007708 | ubuntu-focal |       File "/usr/lib/python3.8/unittest/mock.py", line 1304, in decoration_helper
  2022-06-14 03:53:43.007719 | ubuntu-focal |     arg = exit_stack.enter_context(patching)
  2022-06-14 03:53:43.007729 | ubuntu-focal |
  2022-06-14 03:53:43.007740 | ubuntu-focal |       File "/usr/lib/python3.8/contextlib.py", line 425, in enter_context
  2022-06-14 03:53:43.007750 | ubuntu-focal |     result = _cm_type.__enter__(cm)
  2022-06-14 03:53:43.007778 | ubuntu-focal |
  2022-06-14 03:53:43.007790 | ubuntu-focal |       File "/usr/lib/python3.8/unittest/mock.py", line 1377, in __enter__
  2022-06-14 03:53:43.007800 | ubuntu-focal |     self.target = self.getter()
  2022-06-14 03:53:43.007810 | ubuntu-focal |
  2022-06-14 03:53:43.007820 | ubuntu-focal |       File "/usr/lib/python3.8/unittest/mock.py", line 1552, in <lambda>
  2022-06-14 03:53:43.007830 | ubuntu-focal |     getter = lambda: _importer(target)
  2022-06-14 03:53:43.007840 | ubuntu-focal |
  2022-06-14 03:53:43.007849 | ubuntu-focal |       File "/usr/lib/python3.8/unittest/mock.py", line 1228, in _importer
  2022-06-14 03:53:43.007859 | ubuntu-focal |     thing = _dot_lookup(thing, comp, import_path)
  2022-06-14 03:53:43.007869 | ubuntu-focal |
  2022-06-14 03:53:43.007878 | ubuntu-focal |       File "/usr/lib/python3.8/unittest/mock.py", line 1218, in _dot_lookup
  2022-06-14 03:53:43.007888 | ubuntu-focal |     return getattr(thing, comp)
  2022-06-14 03:53:43.007898 | ubuntu-focal |
  2022-06-14 03:53:43.007908 | ubuntu-focal |     AttributeError: module 'pyroute2' has no attribute 'netlink'
  2022-06-14 03:53:43.007918 | ubuntu-focal |
  2022-06-14 03:53:43.007928 | ubuntu-focal |
  2022-06-14 03:53:43.007937 | ubuntu-focal | neutron.tests.unit.agent.linux.test_tc_lib.TcPolicyClassTestCase.test_list_tc_policy_classes
  2022-06-14 03:53:43.007947 | ubuntu-focal | --------------------------------------------------------------------------------------------
  2022-06-14 03:53:43.007957 | ubuntu-focal |
  2022-06-14 03:53:43.007974 | ubuntu-focal | Captured traceback:
  2022-06-14 03:53:43.007985 | ubuntu-focal | ~~~~~~~~~~~~~~~~~~~
  2022-06-14 03:53:43.007995 | ubuntu-focal |     Traceback (most recent call last):
  2022-06-14 03:53:43.008004 | ubuntu-focal |
  2022-06-14 03:53:43.008014 | ubuntu-focal |       File "/usr/lib/python3.8/unittest/mock.py", line 1215, in _dot_lookup
  2022-06-14 03:53:43.008024 | ubuntu-focal |     return getattr(thing, comp)
  2022-06-14 03:53:43.008034 | ubuntu-focal |
  2022-06-14 03:53:43.008047 | ubuntu-focal |     AttributeError: module 'pyroute2' has no attribute 'netlink'
  2022-06-14 03:53:43.008057 | ubuntu-focal |
  2022-06-14 03:53:43.008067 | ubuntu-focal |
  2022-06-14 03:53:43.008079 | ubuntu-focal | During handling of the above exception, another exception occurred:
  2022-06-14 03:53:43.008088 | ubuntu-focal |
  2022-06-14 03:53:43.008098 | ubuntu-focal |
  2022-06-14 03:53:43.008108 | ubuntu-focal |     Traceback (most recent call last):
  2022-06-14 03:53:43.008117 | ubuntu-focal |
  2022-06-14 03:53:43.008127 | ubuntu-focal |       File "/home/zuul/src/opendev.org/openstack/neutron/neutron/tests/base.py", line 182, in func
  2022-06-14 03:53:43.008144 | ubuntu-focal |     return f(self, *args, **kwargs)
  2022-06-14 03:53:43.008155 | ubuntu-focal |
  2022-06-14 03:53:43.008164 | ubuntu-focal |       File "/usr/lib/python3.8/unittest/mock.py", line 1322, in patched
  2022-06-14 03:53:43.008174 | ubuntu-focal |     with self.decoration_helper(patched,
  2022-06-14 03:53:43.008184 | ubuntu-focal |
  2022-06-14 03:53:43.008198 | ubuntu-focal |       File "/usr/lib/python3.8/contextlib.py", line 113, in __enter__
  2022-06-14 03:53:43.008208 | ubuntu-focal |     return next(self.gen)
  2022-06-14 03:53:43.008217 | ubuntu-focal |
  2022-06-14 03:53:43.008227 | ubuntu-focal |       File "/usr/lib/python3.8/unittest/mock.py", line 1304, in decoration_helper
  2022-06-14 03:53:43.008237 | ubuntu-focal |     arg = exit_stack.enter_context(patching)
  2022-06-14 03:53:43.008246 | ubuntu-focal |
  2022-06-14 03:53:43.008256 | ubuntu-focal |       File "/usr/lib/python3.8/contextlib.py", line 425, in enter_context
  2022-06-14 03:53:43.008266 | ubuntu-focal |     result = _cm_type.__enter__(cm)
  2022-06-14 03:53:43.008275 | ubuntu-focal |
  2022-06-14 03:53:43.008285 | ubuntu-focal |       File "/usr/lib/python3.8/unittest/mock.py", line 1377, in __enter__
  2022-06-14 03:53:43.008295 | ubuntu-focal |     self.target = self.getter()
  2022-06-14 03:53:43.008305 | ubuntu-focal |
  2022-06-14 03:53:43.008315 | ubuntu-focal |       File "/usr/lib/python3.8/unittest/mock.py", line 1552, in <lambda>
  2022-06-14 03:53:43.008325 | ubuntu-focal |     getter = lambda: _importer(target)
  2022-06-14 03:53:43.008339 | ubuntu-focal |
  2022-06-14 03:53:43.008349 | ubuntu-focal |       File "/usr/lib/python3.8/unittest/mock.py", line 1228, in _importer
  2022-06-14 03:53:43.008359 | ubuntu-focal |     thing = _dot_lookup(thing, comp, import_path)
  2022-06-14 03:53:43.008369 | ubuntu-focal |
  2022-06-14 03:53:43.008379 | ubuntu-focal |       File "/usr/lib/python3.8/unittest/mock.py", line 1218, in _dot_lookup
  2022-06-14 03:53:43.008388 | ubuntu-focal |     return getattr(thing, comp)
  2022-06-14 03:53:43.008398 | ubuntu-focal |
  2022-06-14 03:53:43.008408 | ubuntu-focal |     AttributeError: module 'pyroute2' has no attribute 'netlink'
  2022-06-14 03:53:43.008418 | ubuntu-focal |
  2022-06-14 03:53:43.008428 | ubuntu-focal |
  2022-06-14 03:53:43.008437 | ubuntu-focal | neutron.tests.unit.privileged.agent.linux.test_ip_lib.IpLibTestCase.test_get_link_vfs
  2022-06-14 03:53:43.008447 | ubuntu-focal | -------------------------------------------------------------------------------------
  2022-06-14 03:53:43.008457 | ubuntu-focal |
  2022-06-14 03:53:43.008466 | ubuntu-focal | Captured traceback:
  2022-06-14 03:53:43.008476 | ubuntu-focal | ~~~~~~~~~~~~~~~~~~~
  2022-06-14 03:53:43.008486 | ubuntu-focal |     Traceback (most recent call last):
  2022-06-14 03:53:43.008495 | ubuntu-focal |
  2022-06-14 03:53:43.008505 | ubuntu-focal |       File "/home/zuul/src/opendev.org/openstack/neutron/neutron/tests/base.py", line 182, in func
  2022-06-14 03:53:43.008515 | ubuntu-focal |     return f(self, *args, **kwargs)
  2022-06-14 03:53:43.008525 | ubuntu-focal |
  2022-06-14 03:53:43.008547 | ubuntu-focal |       File "/home/zuul/src/opendev.org/openstack/neutron/neutron/tests/unit/privileged/agent/linux/test_ip_lib.py", line 239, in test_get_link_vfs
  2022-06-14 03:53:43.008559 | ubuntu-focal |     vf_info.append(pyroute2.netlink.nlmsg_base())
  2022-06-14 03:53:43.008569 | ubuntu-focal |
  2022-06-14 03:53:43.008578 | ubuntu-focal |     AttributeError: module 'pyroute2' has no attribute 'netlink'

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



References