]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Fix xtremio slow unit tests
authorTom Barron <tpb@dyncloud.net>
Thu, 21 Jan 2016 20:53:03 +0000 (15:53 -0500)
committerTom Barron <tpb@dyncloud.net>
Fri, 22 Jan 2016 11:28:53 +0000 (06:28 -0500)
This commit mocks out time.sleep() in the test_retry_request()
method of test_emc_xtremio.EMCXIODriverTestCase.

As documented in the accompanying bug, this yields about a 6X
speedup for this unit test suite.

Change-Id: I86647dce1fe8a6e8281ee3617fbc5e5c1332404d
Closes-Bug: #1536782

cinder/tests/unit/test_emc_xtremio.py

index fb2a032c4bc4ed144e76d24723b7d79f0f105d9f..1010034d2fa8aefae4f9fee476e42eb3a8b3ce2f 100644 (file)
@@ -13,6 +13,8 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
+import time
+
 import mock
 
 from cinder import exception
@@ -580,6 +582,7 @@ class EMCXIODriverTestCase(test.TestCase):
 
         self.data = CommonData()
 
+    @mock.patch.object(time, 'sleep', mock.Mock(return_value=0))
     def test_retry_request(self, req):
         busy_response = mock.MagicMock()
         busy_response.status_code = 400