From: Tom Barron Date: Thu, 21 Jan 2016 20:53:03 +0000 (-0500) Subject: Fix xtremio slow unit tests X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=f342638d33c6d995b173b4ecf904872b3949da57;p=openstack-build%2Fcinder-build.git Fix xtremio slow unit tests 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 --- diff --git a/cinder/tests/unit/test_emc_xtremio.py b/cinder/tests/unit/test_emc_xtremio.py index fb2a032c4..1010034d2 100644 --- a/cinder/tests/unit/test_emc_xtremio.py +++ b/cinder/tests/unit/test_emc_xtremio.py @@ -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