]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Make EMC SMI-S driver unit tests faster.
authorXing Yang <xing.yang@emc.com>
Fri, 28 Feb 2014 22:07:32 +0000 (17:07 -0500)
committerXing Yang <xing.yang@emc.com>
Fri, 28 Feb 2014 22:33:43 +0000 (17:33 -0500)
Some of EMC SMI-S driver unit tests are very slow.
This patch uses a fake_sleep in unit tests to return right away.

Change-Id: Ia8a429799066ccde51079be68408498805869774
Closes-Bug: #1285927

cinder/tests/test_emc.py

index 1a13ba01ca65d8a530ac390e4f5ef1216a3fbd10..1496dfe04a1b585b3b289038722fcb576159d492 100644 (file)
@@ -17,6 +17,7 @@
 import os
 import shutil
 import tempfile
+import time
 from xml.dom.minidom import Document
 
 import mock
@@ -909,6 +910,8 @@ class EMCSMISISCSIDriverTestCase(test.TestCase):
         instancename = FakeCIMInstanceName()
         self.stubs.Set(EMCSMISCommon, '_getinstancename',
                        instancename.fake_getinstancename)
+        self.stubs.Set(time, 'sleep',
+                       self.fake_sleep)
         driver = EMCSMISISCSIDriver(configuration=configuration)
         driver.db = FakeDB()
         self.driver = driver
@@ -961,6 +964,9 @@ class EMCSMISISCSIDriverTestCase(test.TestCase):
         output.append(item2)
         return output
 
+    def fake_sleep(self, seconds):
+        return
+
     def test_get_volume_stats(self):
         self.driver.get_volume_stats(True)
 
@@ -1106,6 +1112,8 @@ class EMCSMISFCDriverTestCase(test.TestCase):
         instancename = FakeCIMInstanceName()
         self.stubs.Set(EMCSMISCommon, '_getinstancename',
                        instancename.fake_getinstancename)
+        self.stubs.Set(time, 'sleep',
+                       self.fake_sleep)
         driver = EMCSMISFCDriver(configuration=configuration)
         driver.db = FakeDB()
         self.driver = driver
@@ -1150,6 +1158,9 @@ class EMCSMISFCDriverTestCase(test.TestCase):
         conn = FakeEcomConnection()
         return conn
 
+    def fake_sleep(self, seconds):
+        return
+
     def test_get_volume_stats(self):
         self.driver.get_volume_stats(True)