add lock fixture to lockutils for locking in tests

Bug #1229437 reported by Matthew Treinish
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oslo-incubator
Fix Released
Medium
Matthew Treinish

Bug Description

When running unit tests in parallel it is sometimes required to have locking between tests to prevent them from running at the same time. However, just using the lockutils.synchronized decorator doesn't work because of cleanups are also expected to be inside of the lock. Tempest added LockFixture which uses lockutils.lock() inside of a fixture so that addcleanup will be run inside of the lock.

However, this is generally usable in any openstack project that runs it's tests in parallel. So in Icehouse it'll be useful to move the fixture out of tempest and directly into lockutils.

Changed in oslo:
assignee: nobody → Matthew Treinish (treinish)
Changed in oslo:
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to oslo-incubator (master)

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

Changed in oslo:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to oslo-incubator (master)

Reviewed: https://review.openstack.org/49666
Committed: http://github.com/openstack/oslo-incubator/commit/29d387c3e59e18847584b84d68cac536065a8e72
Submitter: Jenkins
Branch: master

commit 29d387c3e59e18847584b84d68cac536065a8e72
Author: Matthew Treinish <email address hidden>
Date: Thu Oct 3 22:42:55 2013 -0400

    Add LockFixture to lockutils

    This commit adds a fixture class to be used instead of external
    locking with the synchronized decorator. When running tests in
    parallel the synchronized decorator won't synchronize the tearDown
    and addCleanup methods for a test. By using the fixture which does
    LockFixture the unlocking is done by using addCleanup() ensuring that
    tearDown and later addCleanup methods are run inside the lock
    context.

    Closes-Bug: #1229437

    Change-Id: I61af5e9d385bb7ef2e6402366fb8c5c09f749986

Changed in oslo:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in oslo:
milestone: none → icehouse-1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in oslo:
milestone: icehouse-1 → 2014.1
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.