summaryrefslogtreecommitdiffstats
path: root/tests/unit/test_lockutils.py
Commit message (Collapse)AuthorAgeFilesLines
* Enable hacking H402 testSergey Lukjanov2013-06-031-3/+3
| | | | | | H402 one line docstring needs punctuation Change-Id: Ie848453cace318d8310cdf0234c512f4c1121119
* Added convenience APIs for lockutilsZhongyue Luo2013-05-091-0/+16
| | | | | | | | | | | | | | The lock_file_prefix for each project doesn't need to be configurable or frequently changed. This patch provides a convenience API which returns a partial object of the synchronized decorator to avoid passing the prefix each time locks are used. The set_defaults method is also provided to change the default value of lock_path when needed. Fixes bug #1065524 Change-Id: I7b67f0a482da4be6d53a70db5bbd22dc91bdc10c
* Locking edge case when lock_path does not existGary Kotton2013-03-221-2/+0
| | | | | | | | | | 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
* lockutils: add a failing unit testMark McLoughlin2013-03-221-3/+22
| | | | | | | | | 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
* lockutils: improve the external locks testMark McLoughlin2013-03-221-11/+13
| | | | | | | | | | | | | | | | | | 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
* Removes unused imports in the tests moduleZhongyue Luo2013-03-201-3/+0
| | | | | | Fixes bug #1157596 Change-Id: I36d5484eaa2f0e21188eed6e70cc1ad785233d6a
* Replace direct use of testtools BaseTestCase.Monty Taylor2013-01-241-4/+3
| | | | | | | | | 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
* Use testtools as test base class.Monty Taylor2013-01-241-2/+1
| | | | | | | | | | | | | 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
* Fixes import order errorsZhongyue Luo2013-01-181-1/+1
| | | | Change-Id: I3e35230dd2d96ab9f5a8c11b9ec1cd8d2d00e347
* Eliminate sleep in the lockutils test case (across processes)Davanum Srinivas2013-01-071-32/+48
| | | | | | | | | | 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
* Disable lockutils test_synchronized_externallyMark McLoughlin2013-01-041-0/+2
| | | | | | | | | | 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
* Move nova's util.synchronized decorator to openstack common.Michael Still2012-10-181-0/+165
In the end I needed to port utils.ensure_tree as well. Resolves bug 1063230. Change-Id: I6e6fa8201de2cac3f17e6c60d7b16f7df7c64116