From 63fae18528943cbdd3762dd4ff3678bd3bc749e9 Mon Sep 17 00:00:00 2001 From: Eric Fried Date: Thu, 2 Aug 2018 14:26:12 -0500 Subject: [PATCH] Grease some more tests hitting RetryDecorator That's "grease" in the sense of "lubricate", or "make faster". Not in the sense of "kill with an M3 submachine gun". Similar optimizations to [1] in libvirt/test_guest (RetryDecorator in detach_device_with_retry) and disk/mount/test_api (RetryDecorator in Mount.map_dev). [1] I60d11fc9a9e8569b1663c7319a5c25b921c5de1a Change-Id: Ic7ad60ce89c93c0f03c040e244f8191c963c08f3 --- nova/tests/unit/virt/disk/mount/test_api.py | 2 ++ nova/tests/unit/virt/libvirt/test_guest.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/nova/tests/unit/virt/disk/mount/test_api.py b/nova/tests/unit/virt/disk/mount/test_api.py index baaa81ae7d93..b92f43abf47b 100644 --- a/nova/tests/unit/virt/disk/mount/test_api.py +++ b/nova/tests/unit/virt/disk/mount/test_api.py @@ -28,6 +28,8 @@ AUTOMAP_PARTITION = "/dev/nullp77" MAP_PARTITION = "/dev/mapper/nullp77" +# Make RetryDecorator not actually sleep on retries +@mock.patch('oslo_service.loopingcall._ThreadingEvent.wait', new=mock.Mock()) class MountTestCase(test.NoDBTestCase): def _test_map_dev(self, partition): mount = api.Mount(mock.sentinel.image, mock.sentinel.mount_dir) diff --git a/nova/tests/unit/virt/libvirt/test_guest.py b/nova/tests/unit/virt/libvirt/test_guest.py index d34b22ac44fb..b7f484e1abf2 100644 --- a/nova/tests/unit/virt/libvirt/test_guest.py +++ b/nova/tests/unit/virt/libvirt/test_guest.py @@ -34,6 +34,8 @@ if sys.version_info > (3,): long = int +# Make RetryDecorator not actually sleep on retries +@mock.patch('oslo_service.loopingcall._ThreadingEvent.wait', new=mock.Mock()) class GuestTestCase(test.NoDBTestCase): def setUp(self):