yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #55819
[Bug 1619028] [NEW] test_get_free_namespace_port fails on systems without sysctl
Public bug reported:
If the unit test test_get_free_namespace_port runs on a system without
sysctl, then the test fails as it tries to execute sysctl, because
sysctl doesn't exist.
======================================================================
FAIL: neutron.tests.unit.tests.common.test_net_helpers.PortAllocationTestCase.test_get_free_namespace_port
neutron.tests.unit.tests.common.test_net_helpers.PortAllocationTestCase.test_get_free_namespace_port
----------------------------------------------------------------------
_StringException: Empty attachments:
pythonlogging:''
stderr
stdout
Traceback (most recent call last):
File "neutron/tests/unit/tests/common/test_net_helpers.py", line 65, in test_get_free_namespace_port
n_const.PROTO_NAME_TCP)
File "neutron/tests/common/net_helpers.py", line 215, in get_free_namespace_port
return get_unused_port(used_ports)
File "neutron/tests/common/net_helpers.py", line 186, in get_unused_port
['sysctl', '-n', 'net.ipv4.ip_local_port_range'])
File "neutron/agent/linux/utils.py", line 117, in execute
addl_env=addl_env)
File "neutron/agent/linux/utils.py", line 87, in create_process
stderr=subprocess.PIPE)
File "neutron/common/utils.py", line 85, in subprocess_popen
close_fds=close_fds, env=env)
File "/var/lib/jenkins/workspace/test-neutron-rax-patches-change/virtualenv/local/lib/python2.7/site-packages/eventlet/green/subprocess.py", line 53, in __init__
subprocess_orig.Popen.__init__(self, args, 0, *argss, **kwds)
File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1259, in _execute_child
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.
** Affects: neutron
Importance: Undecided
Assignee: Corey Wright (coreywright)
Status: In Progress
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1619028
Title:
test_get_free_namespace_port fails on systems without sysctl
Status in neutron:
In Progress
Bug description:
If the unit test test_get_free_namespace_port runs on a system without
sysctl, then the test fails as it tries to execute sysctl, because
sysctl doesn't exist.
======================================================================
FAIL: neutron.tests.unit.tests.common.test_net_helpers.PortAllocationTestCase.test_get_free_namespace_port
neutron.tests.unit.tests.common.test_net_helpers.PortAllocationTestCase.test_get_free_namespace_port
----------------------------------------------------------------------
_StringException: Empty attachments:
pythonlogging:''
stderr
stdout
Traceback (most recent call last):
File "neutron/tests/unit/tests/common/test_net_helpers.py", line 65, in test_get_free_namespace_port
n_const.PROTO_NAME_TCP)
File "neutron/tests/common/net_helpers.py", line 215, in get_free_namespace_port
return get_unused_port(used_ports)
File "neutron/tests/common/net_helpers.py", line 186, in get_unused_port
['sysctl', '-n', 'net.ipv4.ip_local_port_range'])
File "neutron/agent/linux/utils.py", line 117, in execute
addl_env=addl_env)
File "neutron/agent/linux/utils.py", line 87, in create_process
stderr=subprocess.PIPE)
File "neutron/common/utils.py", line 85, in subprocess_popen
close_fds=close_fds, env=env)
File "/var/lib/jenkins/workspace/test-neutron-rax-patches-change/virtualenv/local/lib/python2.7/site-packages/eventlet/green/subprocess.py", line 53, in __init__
subprocess_orig.Popen.__init__(self, args, 0, *argss, **kwds)
File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1259, in _execute_child
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.
To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1619028/+subscriptions
Follow ups