Primary VDI and Resize XenAPI tests interfering with each other

Bug #1180671 reported by Rick Harris
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
High
Rick Harris

Bug Description

The following two tests in test_xenapi are interfering with each other:

- test_instance_snapshot_fails_with_no_primary_vdi
- test_migrate_rollback_when_resize_down_fs_fails

When only those two tests are run, we get the following result:

http://paste.openstack.org/show/37312/

I'm not sure how this landed in trunk other than that Jenkins may have run the tests in a different order avoiding the failure. That said, I'm able to consistently reproduce that, so that's looking less and less likely.

Tags: xenserver
Changed in nova:
status: New → In Progress
assignee: nobody → Rick Harris (rconradharris)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/29346

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/29346
Committed: http://github.com/openstack/nova/commit/4e560d49d4a8d08341dae6df5e123e1be1b3c779
Submitter: Jenkins
Branch: master

commit 4e560d49d4a8d08341dae6df5e123e1be1b3c779
Author: Rick Harris <email address hidden>
Date: Thu May 16 08:02:21 2013 +0000

    Mox should cleanup before stubs

    Tests that define both Mox and Stubs may not receive a proper cleanup by the
    `TestCase` base class. The reason is that the order in which the Mox and Stubs
    are unset may not necessarily match-up with the order in which the tests
    called them. For example:

    Suppose we have a test that Stubs a method in its `setUp` and then Mox's that
    same method in the test body:

        Stub: Original-Func -> Stubbed-Func
        Mox: Stubbed-Func -> Mocked-Func

    Now when `TestCase` ultimately does its `cleanUp`, it will UnStub before
    UnMocking:

        UnStub: Stubbed-Func -> Original-Func
        UnMox: Mocked-Func -> Stubbed-Func

    Notice that generic cleanup has mistakingly left `Stubbed-Func` in place.

    Given that Stubs and Mox can be performed in any order, the upshot here is
    that the generic cleanup can't always be relied on.

    The proposed solution has two parts: a best-practice change and a small
    code-change.

    The code-change is to reverse the current order to UnMox before UnStubbing.
    While in theory the order is arbitrary, in practice, we have lots of Stubs in
    `setUp` methods already, so UnMox'ing first makes sense (and it fixes a
    current bug to boot!)

    The best-practice change is to recommend against stubbing and mocking the same
    function as well as to always place stubs before mocks when relying on the
    generic cleanup. If a developers needs to deviate from this, cleanup of stubs
    created after mocks are their responsibility.

    Fixes bug 1180671

    Change-Id: I42ab8b55026c0a133625a7cc81ed8b960e9d47d7

Changed in nova:
status: In Progress → Fix Committed
tags: added: xenserver
Changed in nova:
importance: Undecided → High
Thierry Carrez (ttx)
Changed in nova:
milestone: none → havana-1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: havana-1 → 2013.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.