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
This commit is contained in:
Xing Yang 2014-02-28 17:07:32 -05:00
parent 6b15c40ba9
commit 41b772fc09
1 changed files with 11 additions and 0 deletions

View 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)