From c6f7f1920e52ff3d44ab16e1fe77b895b5a4ab16 Mon Sep 17 00:00:00 2001 From: john-griffith Date: Mon, 7 Jan 2013 10:08:16 -0700 Subject: [PATCH] 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 --- cinder/tests/api/contrib/test_admin_actions.py | 7 +++++++ 1 file changed, 7 insertions(+) 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) -- 2.45.2