def test_resume_compute_exception_wait_slave_available(self, mock_sleep):
side_effect_xenapi_failure = FakeXenAPIException
side_effect_plugin_error = [self.pluginlib.PluginError(
"Wait for the slave to become available"),
None]
self.mock_patch_object(self.session.xenapi.VM,
'start')
self.session.xenapi.VM.start.side_effect = \
side_effect_xenapi_failure
self.host._run_command.side_effect = side_effect_plugin_error
self.host.XenAPI.Failure = FakeXenAPIException
expected = [call(["xe", "vm-start", "uuid=%s" % 'fake_compute_uuid']),
call(["xe", "vm-start", "uuid=%s" % 'fake_compute_uuid'])]
self.host._resume_compute(self.session,
'fake_compute_ref',
'fake_compute_uuid')
self.session.xenapi.VM.start.assert_called_with(
'fake_compute_ref', False, True)
self.assertEqual(expected, self.host._run_command.call_args_list)
mock_sleep.assert_called_once()
评论列表
文章目录