Extensions unit tests failing after neutron change
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
networking-bgpvpn |
Fix Released
|
Undecided
|
Thomas Morin | ||
networking-sfc |
Fix Released
|
Undecided
|
Bernard Cafarelli | ||
neutron |
Fix Released
|
Undecided
|
Ihar Hrachyshka |
Bug Description
Recent gate runs fail on unit tests, example:
http://
networking_
Captured traceback:
~~~~~~~~~~~~~~~~~~~
b'Traceback (most recent call last):'
b' File "/tmp/openstack
b' return f(self, *args, **kwargs)'
b' File "/home/
b' self._test_
b' File "/home/
b" content_
b' File "/home/
b' content_
b' File "/home/
b' expect_
b' File "/home/
b' self._check_
b' File "/home/
b' res)'
b'webtest.
b'b\
b''
After some research and bisect, these are broken since 93d8376c44cdba5
https:/
Fast way to reproduce on single failing test:
tox -e py27 networking_
Changed in networking-sfc: | |
assignee: | nobody → Bernard Cafarelli (bcafarel) |
status: | New → In Progress |
Changed in neutron: | |
status: | New → Confirmed |
tags: | added: gate-failure |
tags: | added: unittest |
Changed in bgpvpn: | |
status: | In Progress → Fix Released |
Here is a clean traceback of a failed bgpvpn create test (after commenting out the retry decorators):
This is with networking_ bgpvpn. tests.unit. extensions. test_bgpvpn. BgpvpnExtension TestCase. test_bgpvpn_ create_ with_valid_ route_targets .
Traceback (most recent call last): teom7365/ prog/openstack/ networking- bgpvpn/ .tmp/tmp. FxNzLbmRqx/ openstack/ neutron/ neutron/ api/v2/ resource. py", line 79, in resource request= request, **args) teom7365/ prog/openstack/ networking- bgpvpn/ .tmp/tmp. FxNzLbmRqx/ openstack/ neutron/ neutron/ api/v2/ base.py" , line 438, in create request, body, **kwargs) teom7365/ prog/openstack/ networking- bgpvpn/ .tmp/tmp. FxNzLbmRqx/ openstack/ neutron/ neutron/ api/v2/ base.py" , line 482, in _create teom7365/ prog/openstack/ networking- bgpvpn/ .tmp/tmp. FxNzLbmRqx/ openstack/ neutron/ neutron/ quota/_ _init__ .py", line 232, in make_reservation teom7365/ prog/openstack/ networking- bgpvpn/ .tmp/tmp. FxNzLbmRqx/ openstack/ neutron/ neutron/ db/quota/ driver. py", line 176, in make_reservation teom7365/ prog/openstack/ networking- bgpvpn/ .tmp/tmp. FxNzLbmRqx/ openstack/ neutron/ neutron/ db/quota/ driver. py", line 68, in get_tenant_quotas Quota.get_ objects( context, project_ id=tenant_ id) teom7365/ prog/openstack/ networking- bgpvpn/ .tmp/tmp. FxNzLbmRqx/ openstack/ neutron/ neutron/ objects/ base.py" , line 449, in get_objects modify_ fields_ to_db(kwargs) teom7365/ prog/openstack/ networking- bgpvpn/ .tmp/tmp. FxNzLbmRqx/ openstack/ neutron/ neutron/ objects/ db/api. py", line 49, in get_objects _get_collection ( teom7365/ prog/openstack/ networking- bgpvpn/ .tox/py27/ local/lib/ python2. 7/site- packages/ mock/mock. py", line 698, in __getattr__ "Mock object has no attribute %r" % name)
File "/home/
result = method(
File "/home/
return self._create(
File "/home/
self._plugin)
File "/home/
context,
File "/home/
context, resources, tenant_id)
File "/home/
quota_objs = quota_obj.
File "/home/
**cls.
File "/home/
return plugin.
File "/home/
raise AttributeError(
AttributeError: Mock object has no attribute '_get_collection'
The issue arises because the core plugin is actually a NonCallableMagi cMock :
> /home/teom7365/ prog/openstack/ networking- bgpvpn/ .tmp/tmp. FxNzLbmRqx/ openstack/ neutron/ neutron/ objects/ db/api. py(46)get_ objects( ) to_filters( **kwargs) context, model, _pager=None, **kwargs): session. begin(subtransa ctions= True): to_filters( **kwargs) get_plugin( ) _get_collection ( get_plugin( ) cMock at 0x7f97cff7ff90>
-> filters = _kwargs_
(Pdb) l
41 for k, v in kwargs.items()}
42
43
44 def get_objects(
45 with context.
46 -> filters = _kwargs_
47 # TODO(ihrachys): decompose _get_collection from plugin instance
48 plugin = directory.
49 return plugin.
50 context, model,
51 dict_func=None, # return all the data
(Pdb) directory.
<weakproxy at 0x7f97cfeeff18 to NonCallableMagi
I suspect that we aren't using the unit test framework in a way that creates a real core plugin, but I haven't investigated further yet.
A surprising thing is that this test, run with "python -m testtools.run networking_ bgpvpn. tests.unit. extensions. test_bgpvpn. BgpvpnExtension TestCase. test_bgpvpn_ create_ with_va. ..