From f342638d33c6d995b173b4ecf904872b3949da57 Mon Sep 17 00:00:00 2001 From: Tom Barron Date: Thu, 21 Jan 2016 15:53:03 -0500 Subject: [PATCH] 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 --- cinder/tests/unit/test_emc_xtremio.py | 3 +++ 1 file changed, 3 insertions(+) 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 -- 2.45.2