Interprocess file locks aren't usable in unit tests

Bug #1261728 reported by Roman Podoliaka
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Undecided
Unassigned

Bug Description

Base test case class has a fixture, that overrides CONF.lock_path value, which means that every test case will have CONF.lock_path set to its own temporary dir path. This makes interprocess locks unusable in unit tests, which is likely to break tests when they are run concurrently using testr (e.g. tests using MySQL/PostgreSQL might want to be run exclusively).

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

Reviewed: https://review.openstack.org/62621
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=78d62186e5b0388f740d42cb8da5798cd67d7880
Submitter: Jenkins
Branch: master

commit 78d62186e5b0388f740d42cb8da5798cd67d7880
Author: Roman Podoliaka <email address hidden>
Date: Tue Dec 17 13:52:45 2013 +0200

    Fix interprocess locks when running unit-tests

    When running unit-tests concurrently using testr, we might
    need to use interprocess file locks (e.g. for running various
    tests using the same DB in MySQL/PostgreSQL).

    At the same time file locks are only usable when they are placed
    to one dir, and we have a test fixture that overrides the lock_path
    config value for each test case with a new temporary directory.

    The solution is to create the one temprorary directory for locks
    to be used by all tests before running tests and then remove it
    after running tests. The corresponding helper has been already
    put to openstack.common.lockutils module, we just need to reuse
    it properly, i.e. change the way unit tests are run in tox.ini.

    Closes-Bug: #1261728

    Change-Id: I76f95a9f7fdd31c15e6cf4fd6316c7569284f780

Changed in nova:
status: New → Fix Committed
Changed in nova:
milestone: none → icehouse-2
Thierry Carrez (ttx)
Changed in nova:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: icehouse-2 → 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.