Use SleepFixture instead of mocking _ThreadingEvent.wait
Recently, the _ThreadingEvent class in oslo.service was removed [1] and our unit test patching is preventing us from moving to a newer version of oslo.service [2]. We have patching of the _ThreadingEvent.wait method to bypass the sleep time in the looping call of RetryDecorator, which adds several seconds to the run time of unit tests. This changes things to use the new SleepFixture from oslo.service instead. Depends-On: https://review.openstack.org/616371 [1] I62e9f1a7cde8846be368fbec58b8e0825ce02079 [2] https://review.openstack.org/615676 Change-Id: I45dd7602068eb0ce1331cfefd5a0cf6418bc8e88
This commit is contained in:
parent
32082ebcfc
commit
fded752b16
@ -89,7 +89,7 @@ oslo.privsep==1.23.0
|
||||
oslo.reports==1.18.0
|
||||
oslo.rootwrap==5.8.0
|
||||
oslo.serialization==2.18.0
|
||||
oslo.service==1.24.0
|
||||
oslo.service==1.33.0
|
||||
oslo.utils==3.37.0
|
||||
oslo.versionedobjects==1.33.3
|
||||
oslo.vmware==2.17.0
|
||||
|
@ -27,6 +27,7 @@ import netaddr
|
||||
from oslo_log import log as logging
|
||||
import oslo_messaging as messaging
|
||||
from oslo_serialization import jsonutils
|
||||
from oslo_service import fixture as service_fixture
|
||||
from oslo_utils.fixture import uuidsentinel as uuids
|
||||
from oslo_utils import timeutils
|
||||
from oslo_utils import uuidutils
|
||||
@ -6444,6 +6445,7 @@ class ComputeManagerBuildInstanceTestCase(test.NoDBTestCase):
|
||||
"""Tests that _try_deallocate_network will retry calling
|
||||
_deallocate_network on keystone ConnectFailure errors up to a limit.
|
||||
"""
|
||||
self.useFixture(service_fixture.SleepFixture())
|
||||
deallocate_network_mock.side_effect = \
|
||||
keystone_exception.connection.ConnectFailure
|
||||
req_networks = objects.NetworkRequestList(
|
||||
|
@ -13,6 +13,7 @@
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from oslo_service import fixture as service_fixture
|
||||
|
||||
from nova import test
|
||||
from nova.virt.disk.mount import api
|
||||
@ -29,6 +30,11 @@ MAP_PARTITION = "/dev/mapper/nullp77"
|
||||
|
||||
|
||||
class MountTestCase(test.NoDBTestCase):
|
||||
def setUp(self):
|
||||
super(MountTestCase, self).setUp()
|
||||
# Make RetryDecorator not actually sleep on retries
|
||||
self.useFixture(service_fixture.SleepFixture())
|
||||
|
||||
def _test_map_dev(self, partition):
|
||||
mount = api.Mount(mock.sentinel.image, mock.sentinel.mount_dir)
|
||||
mount.device = ORIG_DEVICE
|
||||
|
@ -17,6 +17,7 @@
|
||||
import sys
|
||||
|
||||
import mock
|
||||
from oslo_service import fixture as service_fixture
|
||||
from oslo_utils import encodeutils
|
||||
import six
|
||||
import testtools
|
||||
@ -46,6 +47,9 @@ class GuestTestCase(test.NoDBTestCase):
|
||||
self.domain = mock.Mock(spec=fakelibvirt.virDomain)
|
||||
self.guest = libvirt_guest.Guest(self.domain)
|
||||
|
||||
# Make RetryDecorator not actually sleep on retries
|
||||
self.useFixture(service_fixture.SleepFixture())
|
||||
|
||||
def test_repr(self):
|
||||
self.domain.ID.return_value = 99
|
||||
self.domain.UUIDString.return_value = "UUID"
|
||||
|
@ -49,7 +49,7 @@ oslo.messaging>=6.3.0 # Apache-2.0
|
||||
oslo.policy>=1.35.0 # Apache-2.0
|
||||
oslo.privsep>=1.23.0 # Apache-2.0
|
||||
oslo.i18n>=3.15.3 # Apache-2.0
|
||||
oslo.service!=1.28.1,>=1.24.0 # Apache-2.0
|
||||
oslo.service>=1.33.0 # Apache-2.0
|
||||
rfc3986>=0.3.1 # Apache-2.0
|
||||
oslo.middleware>=3.31.0 # Apache-2.0
|
||||
psutil>=3.2.2 # BSD
|
||||
|
Loading…
x
Reference in New Issue
Block a user