From: Xing Yang Date: Fri, 28 Feb 2014 22:07:32 +0000 (-0500) Subject: Make EMC SMI-S driver unit tests faster. X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=41b772fc09cd839137dabe6648b11798a43fc1e4;p=openstack-build%2Fcinder-build.git Make EMC SMI-S driver unit tests faster. 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 --- diff --git a/cinder/tests/test_emc.py b/cinder/tests/test_emc.py index 1a13ba01c..1496dfe04 100644 --- a/cinder/tests/test_emc.py +++ b/cinder/tests/test_emc.py @@ -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)