test_get_free_namespace_port fails on systems without sysctl
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
neutron |
Fix Released
|
Low
|
Corey Wright |
Bug Description
If the unit test test_get_
=======
FAIL: neutron.
neutron.
-------
_StringException: Empty attachments:
pythonlogging:''
stderr
stdout
Traceback (most recent call last):
File "neutron/
n_const.
File "neutron/
return get_unused_
File "neutron/
['sysctl', '-n', 'net.ipv4.
File "neutron/
addl_
File "neutron/
stderr=
File "neutron/
close_
File "/var/lib/
subprocess_
File "/usr/lib/
errread, errwrite)
File "/usr/lib/
raise child_exception
OSError: [Errno 2] No such file or directory
Code under test shouldn't be allowed to execute local commands for multiple reasons:
0. a test system is not a deployment system
1. the command might not exist
2. the command's output might be system-dependent
3. the command might unintentionally alter the state of the system
The execution of sysctl should be mocked.
Changed in neutron: | |
importance: | Undecided → Low |
Fix proposed to branch: master /review. openstack. org/363917
Review: https:/