From: john-griffith Date: Mon, 7 Jan 2013 17:08:16 +0000 (-0700) Subject: Use tempdir for lock_path in tests. X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=c6f7f1920e52ff3d44ab16e1fe77b895b5a4ab16;p=openstack-build%2Fcinder-build.git Use tempdir for lock_path in tests. Commit: 2331d3336a6adf4fc13a3b187e91a5d1b1f7c723 introduced use of lockutils but wasn't setting a lock_path, in the tests. As a result we were polluting cinder/openstack/ with cinder-xxxx lockfiles. This patch adds a tempfile and cleanup to the test so we don't leave any junk behind. Change-Id: Idd9fee928ff0fcf3f8d1c30ee88c5306b88e290c --- diff --git a/cinder/tests/api/contrib/test_admin_actions.py b/cinder/tests/api/contrib/test_admin_actions.py index bdfeb0873..8a03466a9 100644 --- a/cinder/tests/api/contrib/test_admin_actions.py +++ b/cinder/tests/api/contrib/test_admin_actions.py @@ -1,3 +1,5 @@ +import shutil +import tempfile import webob from cinder import context @@ -21,10 +23,15 @@ def app(): class AdminActionsTest(test.TestCase): def setUp(self): + self.tempdir = tempfile.mkdtemp() super(AdminActionsTest, self).setUp() self.flags(rpc_backend='cinder.openstack.common.rpc.impl_fake') + self.flags(lock_path=self.tempdir) self.volume_api = volume_api.API() + def tearDown(self): + shutil.rmtree(self.tempdir) + def test_reset_status_as_admin(self): # admin context ctx = context.RequestContext('admin', 'fake', True)