]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
NetApp: Clean up lock file left behind by unit tests
authorRushi Agrawal <rushi.agr@gmail.com>
Tue, 26 Feb 2013 12:15:57 +0000 (17:45 +0530)
committerRushi Agrawal <rushi.agr@gmail.com>
Tue, 26 Feb 2013 12:15:57 +0000 (17:45 +0530)
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

cinder/tests/test_netapp.py

index 0bc8f48de3b20ccd2e9168c11a6e459dd0b75929..f13ab6a4a219711532579b7f087d537025cb55b3 100644 (file)
@@ -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()