10 Commits

Author SHA1 Message Date
Gary Kotton
aa51749bb8 Locking edge case when lock_path does not exist
Fixes bug 1158179

In the case that the lock_path does not exist and there is a contested
resource then the process that was waiting on the lock will not
be locking due to the fact that the directory was deleted.

Change-Id: I75d720d4df499e85386d3e2cc86b927b017e12ac
2013-03-22 10:37:26 +00:00
Mark McLoughlin
bda7d1e8cd lockutils: add a failing unit test
Add a unit test which fails because of #1107950 - in this case,
lockutils is deleting the lock directory every time the lock is dropped
even though another process might have acquired a lock using that
directory.

Change-Id: Ic82409f9462e570bc102ab469334c53aafc6d7ac
2013-03-22 10:33:57 +00:00
Mark McLoughlin
74fc415f44 lockutils: improve the external locks test
Use a separate directory for the lockutils external locks and for the
test's flocks which are used to check that serialization is actually
occurring. By using the same directory, we can't test the code in
lockutils which auto-creates this directory because the dir gets
deleted by a process by lockutils cleanup while another directory
is using it for flocks.

Also, assume the the handles directory has been created in the parent
rather than having each child attempt to create it.

Related, add a try/finally block so that when a child process throws an
exception it immediately exits rather than deleting the temporary
directories created by the parent.

Change-Id: I32d7e8e05fb3f22cf38fa586f8bc97646c83f182
2013-03-22 10:14:48 +00:00
Zhongyue Luo
2fbb82b14b Removes unused imports in the tests module
Fixes bug #1157596

Change-Id: I36d5484eaa2f0e21188eed6e70cc1ad785233d6a
2013-03-20 16:24:31 +08:00
Monty Taylor
2670fa0557 Replace direct use of testtools BaseTestCase.
Using the BaseTestCase across the tests in the tree lets us put in log
fixtures and consistently handle mox and stubout.

Part of blueprint grizzly-testtools.

Change-Id: Iba7eb2c63b0c514009b2c28e5930b27726a147b0
2013-01-24 16:30:26 +11:00
Monty Taylor
72cadd4f38 Use testtools as test base class.
On the path to testr migration, we need to replace the unittest base classes
with testtools.
Replace tearDown with addCleanup, addCleanup is more resilient than tearDown.
The fixtures library has excellent support for managing and cleaning
tempfiles. Use it.
Replace skip_ with testtools.skipTest

Part of blueprint grizzly-testtools.

Change-Id: I45e11bbb1ff9b31f3278d3b016737dcb7850cd98
2013-01-24 16:26:43 +11:00
Zhongyue Luo
2ce696b94d Fixes import order errors
Change-Id: I3e35230dd2d96ab9f5a8c11b9ec1cd8d2d00e347
2013-01-18 18:06:50 +08:00
Davanum Srinivas
30b597b322 Eliminate sleep in the lockutils test case (across processes)
Fork many processes and try to lock the same set of files
using flock without blocking and make sure we wait for all the processes
to finish as well.

Fixes LP #1068316

Change-Id: I09964b2c5af63f31b5ddee1f18eaf646f8d8ba58
2013-01-07 08:56:03 -05:00
Mark McLoughlin
b6b2f86b94 Disable lockutils test_synchronized_externally
We're seeing this test fail very regularly in Jenkins and it's become
a serious distraction for everyone.

Disable the test temporarily and use a bug #1095957 to track that the
test itself needs fixing.

Change-Id: I0645d8f5f740d40f83d82e5ef7a048f33a44ac2b
2013-01-04 10:44:26 +00:00
Michael Still
3aabd9f0ae Move nova's util.synchronized decorator to openstack common.
In the end I needed to port utils.ensure_tree as well. Resolves
bug 1063230.

Change-Id: I6e6fa8201de2cac3f17e6c60d7b16f7df7c64116
2012-10-18 09:09:17 -07:00