Segment unit tests are not mocking properly
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
neutron |
New
|
Low
|
Unassigned |
Bug Description
Running the segment unit tests - neutron/
{0} neutron.
Captured stderr:
~~~~~~~~~~~~~~~~
/home/
for ep in importlib_
Traceback (most recent call last):
File "/home/
timer()
File "/home/
cb(*args, **kw)
File "/home/
return func(*args, **kwargs)
File "/home/
self._notify()
File "/home/
self.
File "/home/
event.
File "/home/
aggregate_id = self._get_
File "/home/
for aggregate in self.n_
File "/home/
return self._list(
File "/home/
resp, body = self.api.
File "/home/
return self.request(url, 'GET', **kwargs)
File "/home/
if raise_exc and resp.status_code >= 400:
TypeError: '>=' not supported between instances of 'MagicMock' and 'int'
From looking at the code it's not mocking things properly, for example it does this in TestNovaSegment
self.
That code was removed in 2016 in 255e8a839db0be1
The noise doesn't seem to cause the test to fail, but it should be fixed.
There are also keystone auth exceptions in other tests, and again, nothing seems to fail because of it:
raise exceptions.
keystoneauth1.
tags: | added: low-hanging-fruit |
Changed in neutron: | |
assignee: | nobody → Jang YeHoon (yhjang) |
Changed in neutron: | |
assignee: | Jang YeHoon (yhjang) → nobody |
neutron. tests.unit. plugins. ml2.test_ plugin. TestMultiSegmen tNetworks. test_release_ network_ segments fails in a similar way, and since it's also segment-related I'll add it here.
As with the above the test still passes.
{1} neutron. tests.unit. plugins. ml2.test_ plugin. TestMultiSegmen tNetworks. test_release_ network_ segments [0.805345s] ... ok
Captured stderr: bhaley/ git/neutron. work/.tox/ py310/lib/ python3. 10/site- packages/ eventlet/ hubs/hub. py", line 476, in fire_timers bhaley/ git/neutron. work/.tox/ py310/lib/ python3. 10/site- packages/ eventlet/ hubs/timer. py", line 59, in __call__ bhaley/ git/neutron. work/neutron/ common/ utils.py" , line 956, in wrapper bhaley/ git/neutron. work/neutron/ notifiers/ batch_notifier. py", line 58, in synced_send bhaley/ git/neutron. work/neutron/ notifiers/ batch_notifier. py", line 69, in _notify callback( batched_ events) bhaley/ git/neutron. work/neutron/ services/ segments/ plugin. py", line 211, in _send_notifications method( event) bhaley/ git/neutron. work/neutron/ services/ segments/ plugin. py", line 383, in _delete_ nova_inventory aggregate_ id(event. segment_ id) bhaley/ git/neutron. work/neutron/ services/ segments/ plugin. py", line 370, in _get_aggregate_id client. list_aggregates ( bhaley/ git/neutron. work/.tox/ py310/lib/ python3. 10/site- packages/ neutron_ lib/placement/ client. py", line 58, in wrapper bhaley/ git/neutron. work/.tox/ py310/lib/ python3. 10/site- packages/ neutron_ lib/placement/ client. py", line 554, in list_aggregates url).json( ) bhaley/ git/neutron. work/.tox/ py310/lib/ python3. 10/site- packages/ neutron_ lib/placement/ client. py", line 190, in _get get(url, endpoint_ filter= self._ks_ filter, bhaley/ git/neutron. work/.tox/ py310/lib/ python3. 10/site- packages/ keystoneauth1/ session. py", line 1144, in get bhaley/ git/neutron. work/.tox/ py310/lib/ python3. 10/site- packages/ keystoneauth1/ session. py", line 803, in request endpoint( auth, allow=allow, bhaley/ git/neutron. work/.tox/ py310/lib/ python3. 10/site- packages/ keystoneauth1/ session. py", line 1244, in get_endpoint required( auth, 'determine endpoint URL') bhaley/ git/neutron. work/.tox/ py310/lib/ python3. 10/site- packages/ keystoneauth1/ session. py", line 1184, in _auth_required MissingAuthPlug in(msg_ fmt % msg) exceptions. auth_plugins. MissingAuthPlug in: An auth plugin is required to determine endpoint URL
~~~~~~~~~~~~~~~~
Traceback (most recent call last):
File "/home/
timer()
File "/home/
cb(*args, **kw)
File "/home/
return func(*args, **kwargs)
File "/home/
self._notify()
File "/home/
self.
File "/home/
event.
File "/home/
aggregate_id = self._get_
File "/home/
aggregate_uuid = self.p_
File "/home/
return f(self, *a, **k)
File "/home/
return self._get(
File "/home/
return self._client.
File "/home/
return self.request(url, 'GET', **kwargs)
File "/home/
base_url = self.get_
File "/home/
auth = self._auth_
File "/home/
raise exceptions.
keystoneauth1.