Merge "Fix non-existent method of Mock"
This commit is contained in:
commit
839b3624ff
@ -5205,7 +5205,8 @@ class _ComputeAPIUnitTestMixIn(object):
|
||||
mock_rec_action.assert_called_once_with(self.context,
|
||||
instance,
|
||||
instance_actions.LIVE_MIGRATION_CANCEL)
|
||||
mock_lm_abort.called_once_with(self.context, instance, migration.id)
|
||||
mock_lm_abort.assert_called_once_with(self.context, instance,
|
||||
migration.id)
|
||||
|
||||
@mock.patch('nova.compute.api.API._record_action_start')
|
||||
@mock.patch.object(compute_rpcapi.ComputeAPI, 'live_migration_abort')
|
||||
@ -5232,7 +5233,8 @@ class _ComputeAPIUnitTestMixIn(object):
|
||||
support_abort_in_queue=True)
|
||||
mock_rec_action.assert_called_once_with(
|
||||
self.context, instance, instance_actions.LIVE_MIGRATION_CANCEL)
|
||||
mock_lm_abort.called_once_with(self.context, instance, migration)
|
||||
mock_lm_abort.assert_called_once_with(self.context, instance,
|
||||
migration.id)
|
||||
mock_get_migration.reset_mock()
|
||||
mock_rec_action.reset_mock()
|
||||
mock_lm_abort.reset_mock()
|
||||
|
@ -8771,8 +8771,8 @@ class ComputeManagerMigrationTestCase(test.NoDBTestCase,
|
||||
|
||||
mock_remove_conn.assert_called_once_with(self.context, instance,
|
||||
bdm.volume_id, None)
|
||||
mock_attach_delete.called_once_with(self.context,
|
||||
new_attachment_id)
|
||||
mock_attach_delete.assert_called_once_with(self.context,
|
||||
new_attachment_id)
|
||||
self.assertEqual(bdm.attachment_id, orig_attachment_id)
|
||||
self.assertEqual(orig_attachment_id, bdm.connection_info)
|
||||
bdm.save.assert_called_once_with()
|
||||
|
@ -678,8 +678,9 @@ class LiveMigrationTaskTestCase(test.NoDBTestCase):
|
||||
self.task.instance.pci_requests = instance_pci_reqs
|
||||
self.task._check_can_migrate_pci("Src", "Dst")
|
||||
# in case we managed to get away without rasing, check mocks
|
||||
mock_supp_port_binding_ext.called_once_with(self.context)
|
||||
if instance_pci_reqs:
|
||||
mock_supp_port_binding_ext.assert_called_once_with(
|
||||
self.context)
|
||||
self.assertTrue(mock_supp_vif_related_pci_alloc.called)
|
||||
|
||||
# instance has no PCI requests
|
||||
|
@ -108,7 +108,7 @@ class NovaProxyRequestHandlerDBTestCase(test.TestCase):
|
||||
return_value=ctxt):
|
||||
self.wh.new_websocket_client()
|
||||
|
||||
mock_validate.called_once_with(ctxt, '123-456-789')
|
||||
mock_validate.assert_called_once_with(ctxt, '123-456-789')
|
||||
mock_validate_port.assert_called_once_with(
|
||||
ctxt, mock_inst_get.return_value, str(db_obj['port']),
|
||||
db_obj['console_type'])
|
||||
|
@ -290,15 +290,15 @@ class GetNetNameByVfPciAddressTestCase(test.NoDBTestCase):
|
||||
self.mock_get_ifname.return_value = self.if_name
|
||||
net_name = utils.get_net_name_by_vf_pci_address(self.pci_address)
|
||||
self.assertEqual(ref_net_name, net_name)
|
||||
self.mock_get_mac.called_once_with(self.pci_address)
|
||||
self.mock_get_ifname.called_once_with(self.pci_address)
|
||||
self.mock_get_mac.assert_called_once_with(self.pci_address)
|
||||
self.mock_get_ifname.assert_called_once_with(self.pci_address)
|
||||
|
||||
def test_wrong_mac(self):
|
||||
self.mock_get_mac.side_effect = (
|
||||
exception.PciDeviceNotFoundById(self.pci_address))
|
||||
net_name = utils.get_net_name_by_vf_pci_address(self.pci_address)
|
||||
self.assertIsNone(net_name)
|
||||
self.mock_get_mac.called_once_with(self.pci_address)
|
||||
self.mock_get_mac.assert_called_once_with(self.pci_address)
|
||||
self.mock_get_ifname.assert_not_called()
|
||||
|
||||
def test_wrong_ifname(self):
|
||||
@ -307,5 +307,5 @@ class GetNetNameByVfPciAddressTestCase(test.NoDBTestCase):
|
||||
exception.PciDeviceNotFoundById(self.pci_address))
|
||||
net_name = utils.get_net_name_by_vf_pci_address(self.pci_address)
|
||||
self.assertIsNone(net_name)
|
||||
self.mock_get_mac.called_once_with(self.pci_address)
|
||||
self.mock_get_ifname.called_once_with(self.pci_address)
|
||||
self.mock_get_mac.assert_called_once_with(self.pci_address)
|
||||
self.mock_get_ifname.assert_called_once_with(self.pci_address)
|
||||
|
@ -7682,8 +7682,7 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
||||
drvr._disconnect_volume(self.context, connection_info, instance,
|
||||
encryption=encryption)
|
||||
drvr._host.delete_secret.assert_not_called()
|
||||
mock_encryptor.detach_volume.called_once_with(self.context,
|
||||
**encryption)
|
||||
mock_encryptor.detach_volume.assert_called_once_with(**encryption)
|
||||
|
||||
@mock.patch.object(libvirt_driver.LibvirtDriver, '_detach_encryptor')
|
||||
@mock.patch('nova.objects.InstanceList.get_uuids_by_host')
|
||||
@ -12631,9 +12630,9 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
||||
self.assertEqual(info[1]['over_committed_disk_size'], 18146236825)
|
||||
|
||||
vdmock.XMLDesc.assert_called_once_with(0)
|
||||
mock_qemu_img_info.called_once_with('/test/disk.local')
|
||||
mock_stat.called_once_with('/test/disk')
|
||||
mock_get_size.called_once_with('/test/disk')
|
||||
mock_qemu_img_info.assert_called_once_with('/test/disk.local')
|
||||
mock_stat.assert_called_once_with('/test/disk')
|
||||
mock_get_size.assert_called_once_with('/test/disk')
|
||||
mock_get_disk_backing_file.assert_called()
|
||||
|
||||
def test_post_live_migration(self):
|
||||
@ -15389,8 +15388,8 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
||||
"rxvlan", "txvlan"]
|
||||
}
|
||||
self.assertEqual(expect_vf, actualvf)
|
||||
mock_get_net_name.called_once_with(parent_address)
|
||||
mock_dev_lookup.called_once_with(dev_name)
|
||||
mock_get_net_name.assert_called_once_with(parent_address)
|
||||
mock_dev_lookup.assert_called_once_with(dev_name)
|
||||
|
||||
@mock.patch.object(pci_utils, 'get_ifname_by_pci_address')
|
||||
def test_get_pcidev_info_non_nic(self, mock_get_ifname):
|
||||
@ -17356,7 +17355,7 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
||||
self.assertRaises(test.TestingException,
|
||||
drvr._cleanup_failed_start,
|
||||
None, None, None, None, guest, True)
|
||||
mock_cleanup.called_once_with(None, None, network_info=None,
|
||||
mock_cleanup.assert_called_once_with(None, None, network_info=None,
|
||||
block_device_info=None, destroy_disks=True)
|
||||
self.assertTrue(guest.poweroff.called)
|
||||
|
||||
@ -19916,7 +19915,9 @@ class LibvirtDriverTestCase(test.NoDBTestCase, TraitsComparisonMixin):
|
||||
self.context, ins_ref, _fake_network_info(self, 1))
|
||||
mock_get_path.assert_called_once_with(ins_ref)
|
||||
self.assertFalse(mock_remove.called)
|
||||
mock_rmtree.called_once_with('/fake/inst')
|
||||
self.assertEqual(5, mock_rmtree.call_count)
|
||||
mock_rmtree.assert_has_calls([mock.call('/fake/inst_resize',
|
||||
ignore_errors=True)] * 5)
|
||||
|
||||
def test_get_instance_disk_info_exception(self):
|
||||
instance = self._create_instance()
|
||||
|
Loading…
x
Reference in New Issue
Block a user