diff --git a/cinder/tests/test_emc_vnxdirect.py b/cinder/tests/test_emc_vnxdirect.py index 156e925b17a..4848b773863 100644 --- a/cinder/tests/test_emc_vnxdirect.py +++ b/cinder/tests/test_emc_vnxdirect.py @@ -21,6 +21,7 @@ from oslo_concurrency import processutils from cinder import exception from cinder import test +from cinder.tests.utils import ZeroIntervalLoopingCall from cinder.volume import configuration as conf from cinder.volume.drivers.emc.emc_cli_fc import EMCCLIFCDriver from cinder.volume.drivers.emc.emc_cli_iscsi import EMCCLIISCSIDriver @@ -1340,6 +1341,8 @@ Time Remaining: 0 second(s) mock.call('lun', '-list', '-name', 'vol2', '-attachedSnapshot')] fake_cli.assert_has_calls(expect_cmd) + @mock.patch('cinder.openstack.common.loopingcall.FixedIntervalLoopingCall', + new=ZeroIntervalLoopingCall) def test_create_volume_from_snapshot_sync_failed(self): output_smp = ("""LOGICAL UNIT NUMBER 1 @@ -1460,6 +1463,8 @@ Time Remaining: 0 second(s) expected = [mock.call(*self.testData.LUN_EXTEND_CMD('failed_vol1', 2))] fake_cli.assert_has_calls(expected) + @mock.patch('cinder.openstack.common.loopingcall.FixedIntervalLoopingCall', + new=ZeroIntervalLoopingCall) def test_extend_volume_failed(self): commands = [self.testData.LUN_PROPERTY_ALL_CMD('failed_vol1')] results = [self.testData.LUN_PROPERTY('failed_vol1', size=2)] diff --git a/cinder/tests/test_srb.py b/cinder/tests/test_srb.py index 046e5f55af0..6fc2ee5833b 100644 --- a/cinder/tests/test_srb.py +++ b/cinder/tests/test_srb.py @@ -173,7 +173,8 @@ class SRBRetryTestCase(test.TestCase): def test_retry_fail_and_succeed_mixed(self): - @srb.retry(count=4, exceptions=(Exception)) + @srb.retry(count=4, exceptions=(Exception), + sleep_mechanism=srb.retry.SLEEP_NONE) def _try_failing(self): attempted = self.attempts self.attempts = self.attempts + 1 diff --git a/cinder/tests/utils.py b/cinder/tests/utils.py index 14b484081f7..7eee5f20813 100644 --- a/cinder/tests/utils.py +++ b/cinder/tests/utils.py @@ -13,9 +13,9 @@ # under the License. # - from cinder import context from cinder import db +from cinder.openstack.common import loopingcall def get_test_admin_context(): @@ -121,3 +121,9 @@ def create_cgsnapshot(ctxt, for key in kwargs: cgsnap[key] = kwargs[key] return db.cgsnapshot_create(ctxt, cgsnap) + + +class ZeroIntervalLoopingCall(loopingcall.FixedIntervalLoopingCall): + def start(self, interval, **kwargs): + kwargs['initial_delay'] = 0 + return super(ZeroIntervalLoopingCall, self).start(0, **kwargs)