linux IP lib tests conflicting patches causing sporadic UT failures

Bug #1307038 reported by Kevin Benton
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Undecided
Kevin Benton

Bug Description

The following failure is happening sporadically when running the unit tests:

ft1.11275: neutron.tests.unit.test_linux_ip_lib.TestDeviceExists.test_device_exists_StringException: Empty attachments:
  pythonlogging:''
  pythonlogging:'neutron.api.extensions'
  stderr
  stdout

Traceback (most recent call last):
  File "neutron/tests/unit/test_linux_ip_lib.py", line 785, in test_device_exists
    _execute.assert_called_once_with('o', 'link', ('show', 'eth0'))
  File "/home/jenkins/workspace/gate-neutron-python27/.tox/py27/local/lib/python2.7/site-packages/mock.py", line 845, in assert_called_once_with
    raise AssertionError(msg)
AssertionError: Expected to be called once. Called 0 times.

Changed in neutron:
assignee: nobody → Kevin Benton (kevinbenton)
Revision history for this message
Kevin Benton (kevinbenton) wrote :

The root cause of this is the TestMidonetInterfaceDriver test class. The class it inherits from already patches the 'device_exists' method in ip_lib during setup and then it does it again[1]. Double-patching causes the mock library to fail to stop both patches using the stopall method.

This bug surface after the patch merged that removed all of the explicit addCleanup(patch.stop) methods from unit tests.[2]

1. https://github.com/bigswitch/neutron/blob/1e0ea5217a93fadb915c3dcdf4c260738bed70ac/neutron/tests/unit/test_linux_interface.py#L518

2. https://review.openstack.org/#/c/86538/

Changed in neutron:
status: New → In Progress
Revision history for this message
Kevin Benton (kevinbenton) wrote :
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.openstack.org/87097
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=e7ca2541b13d9e755f443b866708865ac22a8bd1
Submitter: Jenkins
Branch: master

commit e7ca2541b13d9e755f443b866708865ac22a8bd1
Author: Kevin Benton <email address hidden>
Date: Sat Apr 12 21:27:36 2014 +0000

    Fix dangling patches in Cisco and Midonet tests

    Cisco Nexus Tests:
    Explicitly stops the patch to sys.modules immediately
    after use to fix sporadic failures caused by the patch
    not being handled correctly by mock.patch.stopall.

    Midonet Interface Test:
    Removes the double-patch of the 'device_exists' method
    in ip_lib.

    Closes-Bug: #1307025
    Closes-Bug: #1307038
    Change-Id: Ie22505bb8e406a61e40819d60c76d229916a6e01

Changed in neutron:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in neutron:
milestone: none → juno-1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in neutron:
milestone: juno-1 → 2014.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.