← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1497444] Re: Functional tests possibly leaving a network namespace around

 

test_ha_router_failover does use mock to manipulate NS names, but I ran
the L3 functional tests and used 'watch ip netns', and all namespace
names were constructed correctly and didn't have any weird 'MagicMock'
substrings in 'em. Something must have changed since this bug was
reported.

** Changed in: neutron
       Status: New => Invalid

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1497444

Title:
  Functional tests possibly leaving a network namespace around

Status in neutron:
  Invalid

Bug description:
  After running the functional tests (dvsm-functional) I noticed I was
  unable to run 'ip netns', it was giving me an error something like:

  <MagicMock name='_get_ns_name()' id='140702292990672'>@agent1

  I was confused until I noticed a failure in a review:

  | ==============================
  | Failed 1 tests - output below:
  | ==============================
  | neutron.tests.functional.agent.test_l3_agent.L3HATestFramework.test_ha_router_failover
  | --------------------------------------------------------------------------------------
  | 
  | Captured traceback:
  | ~~~~~~~~~~~~~~~~~~~
  |     Traceback (most recent call last):
  |       File "neutron/tests/functional/agent/test_l3_agent.py", line 795, in test_ha_router_failover
  |         router1 = self.manage_router(self.agent, router_info)
  |       File "neutron/tests/functional/agent/test_l3_agent.py", line 133, in manage_router
  |         agent._process_added_router(router)
  |       File "neutron/agent/l3/agent.py", line 446, in _process_added_router
  |         self._router_added(router['id'], router)
  |       File "neutron/agent/l3/agent.py", line 335, in _router_added
  |         ri.initialize(self.process_monitor)
  |       File "neutron/agent/l3/ha_router.py", line 87, in initialize
  |         self.ha_network_added()
  |       File "neutron/agent/l3/ha_router.py", line 147, in ha_network_added
  |         prefix=HA_DEV_PREFIX)
  |       File "neutron/agent/linux/interface.py", line 252, in plug
  |         bridge, namespace, prefix)
  |       File "neutron/agent/linux/interface.py", line 346, in plug_new
  |         namespace_obj = ip.ensure_namespace(namespace)
  |       File "neutron/agent/linux/ip_lib.py", line 164, in ensure_namespace
  |         ip = self.netns.add(name)
  |       File "neutron/agent/linux/ip_lib.py", line 794, in add
  |         self._as_root([], ('add', name), use_root_namespace=True)
  |       File "neutron/agent/linux/ip_lib.py", line 281, in _as_root
  |         use_root_namespace=use_root_namespace)
  |       File "neutron/agent/linux/ip_lib.py", line 81, in _as_root
  |         log_fail_as_error=self.log_fail_as_error)
  |       File "neutron/agent/linux/ip_lib.py", line 90, in _execute
  |         log_fail_as_error=log_fail_as_error)
  |       File "neutron/agent/linux/utils.py", line 160, in execute
  |         raise RuntimeError(m)
  |     RuntimeError: 
  |     Command: ['ip', 'netns', 'add', "<MagicMock name='_get_ns_name()' id='140702292990672'>@agent1"]
  |     Exit code: 1
  |     Stdin: 
  |     Stdout: 
  |     Stderr: Cannot not create namespace file "/var/run/netns/<MagicMock name='_get_ns_name()' id='140702292990672'>@agent1": File exists

  That is from http://logs.openstack.org/06/225206/2/check/gate-neutron-
  dsvm-functional/9ca87f0/console.html

  So it looks like a functional test is either creating a network
  namespace and not cleaning it up, or doing something else horribly
  wrong.

  There is a test at cmd/test_netns_cleanup.py that uses mock and
  namespaces, but it wasn't obvious to me that it was the culprit.

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


References