Merge "Use SleepFixture instead of mocking _ThreadingEvent.wait"

This commit is contained in:
Zuul 2018-11-09 03:09:03 +00:00 committed by Gerrit Code Review
commit e27905f482
5 changed files with 14 additions and 2 deletions

View File

@ -89,7 +89,7 @@ oslo.privsep==1.23.0
oslo.reports==1.18.0 oslo.reports==1.18.0
oslo.rootwrap==5.8.0 oslo.rootwrap==5.8.0
oslo.serialization==2.18.0 oslo.serialization==2.18.0
oslo.service==1.24.0 oslo.service==1.33.0
oslo.utils==3.37.0 oslo.utils==3.37.0
oslo.versionedobjects==1.33.3 oslo.versionedobjects==1.33.3
oslo.vmware==2.17.0 oslo.vmware==2.17.0

View File

@ -27,6 +27,7 @@ import netaddr
from oslo_log import log as logging from oslo_log import log as logging
import oslo_messaging as messaging import oslo_messaging as messaging
from oslo_serialization import jsonutils from oslo_serialization import jsonutils
from oslo_service import fixture as service_fixture
from oslo_utils.fixture import uuidsentinel as uuids from oslo_utils.fixture import uuidsentinel as uuids
from oslo_utils import timeutils from oslo_utils import timeutils
from oslo_utils import uuidutils from oslo_utils import uuidutils
@ -6444,6 +6445,7 @@ class ComputeManagerBuildInstanceTestCase(test.NoDBTestCase):
"""Tests that _try_deallocate_network will retry calling """Tests that _try_deallocate_network will retry calling
_deallocate_network on keystone ConnectFailure errors up to a limit. _deallocate_network on keystone ConnectFailure errors up to a limit.
""" """
self.useFixture(service_fixture.SleepFixture())
deallocate_network_mock.side_effect = \ deallocate_network_mock.side_effect = \
keystone_exception.connection.ConnectFailure keystone_exception.connection.ConnectFailure
req_networks = objects.NetworkRequestList( req_networks = objects.NetworkRequestList(

View File

@ -13,6 +13,7 @@
# under the License. # under the License.
import mock import mock
from oslo_service import fixture as service_fixture
from nova import test from nova import test
from nova.virt.disk.mount import api from nova.virt.disk.mount import api
@ -29,6 +30,11 @@ MAP_PARTITION = "/dev/mapper/nullp77"
class MountTestCase(test.NoDBTestCase): 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): def _test_map_dev(self, partition):
mount = api.Mount(mock.sentinel.image, mock.sentinel.mount_dir) mount = api.Mount(mock.sentinel.image, mock.sentinel.mount_dir)
mount.device = ORIG_DEVICE mount.device = ORIG_DEVICE

View File

@ -17,6 +17,7 @@
import sys import sys
import mock import mock
from oslo_service import fixture as service_fixture
from oslo_utils import encodeutils from oslo_utils import encodeutils
import six import six
import testtools import testtools
@ -46,6 +47,9 @@ class GuestTestCase(test.NoDBTestCase):
self.domain = mock.Mock(spec=fakelibvirt.virDomain) self.domain = mock.Mock(spec=fakelibvirt.virDomain)
self.guest = libvirt_guest.Guest(self.domain) self.guest = libvirt_guest.Guest(self.domain)
# Make RetryDecorator not actually sleep on retries
self.useFixture(service_fixture.SleepFixture())
def test_repr(self): def test_repr(self):
self.domain.ID.return_value = 99 self.domain.ID.return_value = 99
self.domain.UUIDString.return_value = "UUID" self.domain.UUIDString.return_value = "UUID"

View File

@ -49,7 +49,7 @@ oslo.messaging>=6.3.0 # Apache-2.0
oslo.policy>=1.35.0 # Apache-2.0 oslo.policy>=1.35.0 # Apache-2.0
oslo.privsep>=1.23.0 # Apache-2.0 oslo.privsep>=1.23.0 # Apache-2.0
oslo.i18n>=3.15.3 # 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 rfc3986>=0.3.1 # Apache-2.0
oslo.middleware>=3.31.0 # Apache-2.0 oslo.middleware>=3.31.0 # Apache-2.0
psutil>=3.2.2 # BSD psutil>=3.2.2 # BSD