From: Rushi Agrawal Date: Tue, 26 Feb 2013 12:15:57 +0000 (+0530) Subject: NetApp: Clean up lock file left behind by unit tests X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=218e2fe52c170d00e1975345dd17f76fad9e1db9;p=openstack-build%2Fcinder-build.git NetApp: Clean up lock file left behind by unit tests The synchronization decorator added to the NetAppISCSIDriver class creates a lock file named cinder/openstack/cinder-netapp_dfm during the unit tests. This commit cleans it up. Fixes bug 1135619 Change-Id: Iec41a0f23d4a1c6668bdcb451c2c02efd3f97500 --- diff --git a/cinder/tests/test_netapp.py b/cinder/tests/test_netapp.py index 0bc8f48de..f13ab6a4a 100644 --- a/cinder/tests/test_netapp.py +++ b/cinder/tests/test_netapp.py @@ -21,7 +21,9 @@ Tests for NetApp volume driver import BaseHTTPServer import httplib +import shutil import StringIO +import tempfile from lxml import etree @@ -975,6 +977,8 @@ class NetAppDriverTestCase(test.TestCase): def setUp(self): super(NetAppDriverTestCase, self).setUp() + self.tempdir = tempfile.mkdtemp() + self.flags(lock_path=self.tempdir) driver = iscsi.NetAppISCSIDriver() self.stubs.Set(httplib, 'HTTPConnection', FakeHTTPConnection) driver._create_client(wsdl_url='http://localhost:8088/dfm.wsdl', @@ -985,6 +989,10 @@ class NetAppDriverTestCase(test.TestCase): driver._set_vfiler('') self.driver = driver + def tearDown(self): + shutil.rmtree(self.tempdir) + super(NetAppDriverTestCase, self).setUp() + def test_connect(self): self.driver.check_for_setup_error()