Merge "Unit tests: fix absurdly slow tests"
This commit is contained in:
commit
4f3fd51e16
@ -677,6 +677,7 @@ class SoftwareConfigServiceTest(common.HeatTestCase):
|
|||||||
|
|
||||||
with mock.patch.object(self.ctx.session, 'refresh'):
|
with mock.patch.object(self.ctx.session, 'refresh'):
|
||||||
f = self.engine.software_config._push_metadata_software_deployments
|
f = self.engine.software_config._push_metadata_software_deployments
|
||||||
|
self.patchobject(f.retry, 'sleep')
|
||||||
self.assertRaises(
|
self.assertRaises(
|
||||||
exception.ConcurrentTransaction,
|
exception.ConcurrentTransaction,
|
||||||
f,
|
f,
|
||||||
|
@ -4839,6 +4839,8 @@ class ServerInternalPortTest(ServersTest):
|
|||||||
server._data = {"internal_ports": jsonutils.dumps(port_ids)}
|
server._data = {"internal_ports": jsonutils.dumps(port_ids)}
|
||||||
self.patchobject(nova.NovaClientPlugin, 'interface_detach')
|
self.patchobject(nova.NovaClientPlugin, 'interface_detach')
|
||||||
self.patchobject(nova.NovaClientPlugin, 'fetch_server')
|
self.patchobject(nova.NovaClientPlugin, 'fetch_server')
|
||||||
|
self.patchobject(nova.NovaClientPlugin.check_interface_detach.retry,
|
||||||
|
'sleep')
|
||||||
nova.NovaClientPlugin.fetch_server.side_effect = [Fake()] * 10
|
nova.NovaClientPlugin.fetch_server.side_effect = [Fake()] * 10
|
||||||
|
|
||||||
exc = self.assertRaises(exception.InterfaceDetachFailed,
|
exc = self.assertRaises(exception.InterfaceDetachFailed,
|
||||||
@ -4966,6 +4968,8 @@ class ServerInternalPortTest(ServersTest):
|
|||||||
return_value=True)
|
return_value=True)
|
||||||
self.patchobject(nova.NovaClientPlugin, 'interface_attach')
|
self.patchobject(nova.NovaClientPlugin, 'interface_attach')
|
||||||
self.patchobject(nova.NovaClientPlugin, 'fetch_server')
|
self.patchobject(nova.NovaClientPlugin, 'fetch_server')
|
||||||
|
self.patchobject(nova.NovaClientPlugin.check_interface_attach.retry,
|
||||||
|
'sleep')
|
||||||
# need to mock 11 times: 1 for port 1122, 10 for port 3344
|
# need to mock 11 times: 1 for port 1122, 10 for port 3344
|
||||||
nova.NovaClientPlugin.fetch_server.side_effect = [Fake()] * 11
|
nova.NovaClientPlugin.fetch_server.side_effect = [Fake()] * 11
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user