Merge "Enforce autospec in irmc tests"
This commit is contained in:
commit
3519b7a37a
@ -87,10 +87,14 @@ class IRMCBIOSTestCase(test_common.BaseIRMCTest):
|
||||
self.assertRaises(exception.UnsupportedDriverExtension,
|
||||
task.driver.bios.factory_reset, task)
|
||||
|
||||
@mock.patch.object(objects.BIOSSettingList, 'sync_node_setting')
|
||||
@mock.patch.object(objects.BIOSSettingList, 'create')
|
||||
@mock.patch.object(objects.BIOSSettingList, 'save')
|
||||
@mock.patch.object(objects.BIOSSettingList, 'delete')
|
||||
@mock.patch.object(objects.BIOSSettingList, 'sync_node_setting',
|
||||
autospec=True)
|
||||
@mock.patch.object(objects.BIOSSettingList, 'create',
|
||||
autospec=True)
|
||||
@mock.patch.object(objects.BIOSSettingList, 'save',
|
||||
autospec=True)
|
||||
@mock.patch.object(objects.BIOSSettingList, 'delete',
|
||||
autospec=True)
|
||||
@mock.patch.object(irmc_bios.irmc.elcm, 'get_bios_settings',
|
||||
autospec=True)
|
||||
def test_cache_bios_settings(self, get_bios_settings_mock,
|
||||
|
@ -1722,7 +1722,8 @@ class IRMCVirtualMediaBootWithVolumeTestCase(test_common.BaseIRMCTest):
|
||||
self.assertRaises(exception.MissingParameterValue,
|
||||
self._call_validate)
|
||||
|
||||
@mock.patch.object(deploy_utils, 'get_single_nic_with_vif_port_id')
|
||||
@mock.patch.object(deploy_utils, 'get_single_nic_with_vif_port_id',
|
||||
autospec=True)
|
||||
def test_prepare_ramdisk_skip(self, mock_nic, mock_viom,
|
||||
check_share_fs_mounted_mock):
|
||||
self._create_iscsi_resources()
|
||||
@ -1731,7 +1732,7 @@ class IRMCVirtualMediaBootWithVolumeTestCase(test_common.BaseIRMCTest):
|
||||
task.driver.boot.prepare_ramdisk(task, {})
|
||||
mock_nic.assert_not_called()
|
||||
|
||||
@mock.patch.object(irmc_boot, '_cleanup_vmedia_boot')
|
||||
@mock.patch.object(irmc_boot, '_cleanup_vmedia_boot', autospec=True)
|
||||
def test_prepare_instance(self, mock_clean, mock_viom,
|
||||
check_share_fs_mounted_mock):
|
||||
mock_conf = self._create_mock_conf(mock_viom)
|
||||
|
@ -50,7 +50,7 @@ class iRMCPeriodicTaskTestCase(test_common.BaseIRMCTest):
|
||||
'key': 'value'
|
||||
}]}
|
||||
|
||||
@mock.patch.object(irmc_common, 'get_irmc_report')
|
||||
@mock.patch.object(irmc_common, 'get_irmc_report', autospec=True)
|
||||
def test__query_raid_config_fgi_status_without_node(
|
||||
self, report_mock):
|
||||
mock_manager = mock.Mock()
|
||||
@ -60,7 +60,7 @@ class iRMCPeriodicTaskTestCase(test_common.BaseIRMCTest):
|
||||
raid_object._query_raid_config_fgi_status(mock_manager, None)
|
||||
self.assertEqual(0, report_mock.call_count)
|
||||
|
||||
@mock.patch.object(irmc_common, 'get_irmc_report')
|
||||
@mock.patch.object(irmc_common, 'get_irmc_report', autospec=True)
|
||||
@mock.patch.object(task_manager, 'acquire', autospec=True)
|
||||
def test__query_raid_config_fgi_status_without_raid_object(
|
||||
self, mock_acquire, report_mock):
|
||||
@ -77,7 +77,7 @@ class iRMCPeriodicTaskTestCase(test_common.BaseIRMCTest):
|
||||
self.context)
|
||||
self.assertEqual(0, report_mock.call_count)
|
||||
|
||||
@mock.patch.object(irmc_common, 'get_irmc_report')
|
||||
@mock.patch.object(irmc_common, 'get_irmc_report', autospec=True)
|
||||
@mock.patch.object(task_manager, 'acquire', autospec=True)
|
||||
def test__query_raid_config_fgi_status_without_input(
|
||||
self, mock_acquire, report_mock):
|
||||
@ -95,7 +95,7 @@ class iRMCPeriodicTaskTestCase(test_common.BaseIRMCTest):
|
||||
self.context)
|
||||
self.assertEqual(0, report_mock.call_count)
|
||||
|
||||
@mock.patch.object(irmc_common, 'get_irmc_report')
|
||||
@mock.patch.object(irmc_common, 'get_irmc_report', autospec=True)
|
||||
@mock.patch.object(task_manager, 'acquire', autospec=True)
|
||||
def test__query_raid_config_fgi_status_without_raid_config(
|
||||
self, mock_acquire, report_mock):
|
||||
@ -110,7 +110,7 @@ class iRMCPeriodicTaskTestCase(test_common.BaseIRMCTest):
|
||||
self.context)
|
||||
self.assertEqual(0, report_mock.call_count)
|
||||
|
||||
@mock.patch.object(irmc_common, 'get_irmc_report')
|
||||
@mock.patch.object(irmc_common, 'get_irmc_report', autospec=True)
|
||||
@mock.patch.object(task_manager, 'acquire', autospec=True)
|
||||
def test__query_raid_config_fgi_status_without_fgi_status(
|
||||
self, mock_acquire, report_mock):
|
||||
@ -132,7 +132,7 @@ class iRMCPeriodicTaskTestCase(test_common.BaseIRMCTest):
|
||||
self.context)
|
||||
self.assertEqual(0, report_mock.call_count)
|
||||
|
||||
@mock.patch.object(irmc_common, 'get_irmc_report')
|
||||
@mock.patch.object(irmc_common, 'get_irmc_report', autospec=True)
|
||||
@mock.patch.object(task_manager, 'acquire', autospec=True)
|
||||
def test__query_raid_config_fgi_status_other_clean_state(
|
||||
self, mock_acquire, report_mock):
|
||||
@ -150,9 +150,11 @@ class iRMCPeriodicTaskTestCase(test_common.BaseIRMCTest):
|
||||
self.context)
|
||||
self.assertEqual(0, report_mock.call_count)
|
||||
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid.IRMCRAID._set_clean_failed')
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_fgi_status')
|
||||
@mock.patch.object(irmc_common, 'get_irmc_report')
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid.IRMCRAID._set_clean_failed',
|
||||
autospec=True)
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_fgi_status',
|
||||
autospec=True)
|
||||
@mock.patch.object(irmc_common, 'get_irmc_report', autospec=True)
|
||||
@mock.patch.object(task_manager, 'acquire', autospec=True)
|
||||
def test__query_raid_config_fgi_status_completing_status(
|
||||
self, mock_acquire, report_mock, fgi_mock, clean_fail_mock):
|
||||
@ -176,9 +178,11 @@ class iRMCPeriodicTaskTestCase(test_common.BaseIRMCTest):
|
||||
fgi_mock.assert_called_once_with(report_mock.return_value,
|
||||
self.node.uuid)
|
||||
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid.IRMCRAID._set_clean_failed')
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_fgi_status')
|
||||
@mock.patch.object(irmc_common, 'get_irmc_report')
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid.IRMCRAID._set_clean_failed',
|
||||
autospec=True)
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_fgi_status',
|
||||
autospec=True)
|
||||
@mock.patch.object(irmc_common, 'get_irmc_report', autospec=True)
|
||||
@mock.patch.object(task_manager, 'acquire', autospec=True)
|
||||
def test__query_raid_config_fgi_status_with_clean_fail(
|
||||
self, mock_acquire, report_mock, fgi_mock, clean_fail_mock):
|
||||
@ -198,15 +202,19 @@ class iRMCPeriodicTaskTestCase(test_common.BaseIRMCTest):
|
||||
task.node.save()
|
||||
task.driver.raid._query_raid_config_fgi_status(mock_manager,
|
||||
self.context)
|
||||
clean_fail_mock.assert_called_once_with(task, fgi_status_dict)
|
||||
clean_fail_mock.assert_called_once_with(mock.ANY, task,
|
||||
fgi_status_dict)
|
||||
report_mock.assert_called_once_with(task.node)
|
||||
fgi_mock.assert_called_once_with(report_mock.return_value,
|
||||
self.node.uuid)
|
||||
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid.IRMCRAID._resume_cleaning')
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid.IRMCRAID._set_clean_failed')
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_fgi_status')
|
||||
@mock.patch.object(irmc_common, 'get_irmc_report')
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid.IRMCRAID._resume_cleaning',
|
||||
autospec=True)
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid.IRMCRAID._set_clean_failed',
|
||||
autospec=True)
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_fgi_status',
|
||||
autospec=True)
|
||||
@mock.patch.object(irmc_common, 'get_irmc_report', autospec=True)
|
||||
@mock.patch.object(task_manager, 'acquire', autospec=True)
|
||||
def test__query_raid_config_fgi_status_with_complete_cleaning(
|
||||
self, mock_acquire, report_mock, fgi_mock, clean_fail_mock,
|
||||
@ -229,12 +237,15 @@ class iRMCPeriodicTaskTestCase(test_common.BaseIRMCTest):
|
||||
report_mock.assert_called_once_with(task.node)
|
||||
fgi_mock.assert_called_once_with(report_mock.return_value,
|
||||
self.node.uuid)
|
||||
clean_mock.assert_called_once_with(task)
|
||||
clean_mock.assert_called_once_with(mock.ANY, task)
|
||||
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid.IRMCRAID._resume_cleaning')
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid.IRMCRAID._set_clean_failed')
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_fgi_status')
|
||||
@mock.patch.object(irmc_common, 'get_irmc_report')
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid.IRMCRAID._resume_cleaning',
|
||||
autospec=True)
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid.IRMCRAID._set_clean_failed',
|
||||
autospec=True)
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_fgi_status',
|
||||
autospec=True)
|
||||
@mock.patch.object(irmc_common, 'get_irmc_report', autospec=True)
|
||||
@mock.patch.object(task_manager, 'acquire', autospec=True)
|
||||
def test__query_raid_config_fgi_status_with_two_nodes_without_raid_config(
|
||||
self, mock_acquire, report_mock, fgi_mock, clean_fail_mock,
|
||||
@ -259,12 +270,15 @@ class iRMCPeriodicTaskTestCase(test_common.BaseIRMCTest):
|
||||
report_mock.assert_called_once_with(task.node)
|
||||
fgi_mock.assert_called_once_with(report_mock.return_value,
|
||||
self.node.uuid)
|
||||
clean_mock.assert_called_once_with(task)
|
||||
clean_mock.assert_called_once_with(mock.ANY, task)
|
||||
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid.IRMCRAID._resume_cleaning')
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid.IRMCRAID._set_clean_failed')
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_fgi_status')
|
||||
@mock.patch.object(irmc_common, 'get_irmc_report')
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid.IRMCRAID._resume_cleaning',
|
||||
autospec=True)
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid.IRMCRAID._set_clean_failed',
|
||||
autospec=True)
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_fgi_status',
|
||||
autospec=True)
|
||||
@mock.patch.object(irmc_common, 'get_irmc_report', autospec=True)
|
||||
@mock.patch.object(task_manager, 'acquire', autospec=True)
|
||||
def test__query_raid_config_fgi_status_with_two_nodes_with_fgi_status_none(
|
||||
self, mock_acquire, report_mock, fgi_mock, clean_fail_mock,
|
||||
@ -291,5 +305,6 @@ class iRMCPeriodicTaskTestCase(test_common.BaseIRMCTest):
|
||||
self.node_2.uuid),
|
||||
mock.call(report_mock.return_value,
|
||||
self.node_2.uuid)])
|
||||
clean_fail_mock.assert_called_once_with(task, fgi_status_dict)
|
||||
clean_mock.assert_called_once_with(task)
|
||||
clean_fail_mock.assert_called_once_with(mock.ANY,
|
||||
task, fgi_status_dict)
|
||||
clean_mock.assert_called_once_with(mock.ANY, task)
|
||||
|
@ -118,7 +118,8 @@ class IRMCPowerInternalMethodsTestCase(test_common.BaseIRMCTest):
|
||||
autospec=True)
|
||||
@mock.patch.object(irmc_common, 'get_irmc_client', spec_set=True,
|
||||
autospec=True)
|
||||
@mock.patch.object(irmc_boot, 'attach_boot_iso_if_needed')
|
||||
@mock.patch.object(irmc_boot, 'attach_boot_iso_if_needed',
|
||||
autospec=True)
|
||||
def test__set_power_state_power_on_ok(
|
||||
self,
|
||||
attach_boot_iso_if_needed_mock,
|
||||
@ -152,7 +153,8 @@ class IRMCPowerInternalMethodsTestCase(test_common.BaseIRMCTest):
|
||||
autospec=True)
|
||||
@mock.patch.object(irmc_common, 'get_irmc_client', spec_set=True,
|
||||
autospec=True)
|
||||
@mock.patch.object(irmc_boot, 'attach_boot_iso_if_needed')
|
||||
@mock.patch.object(irmc_boot, 'attach_boot_iso_if_needed',
|
||||
autospec=True)
|
||||
def test__set_power_state_reboot_ok(
|
||||
self,
|
||||
attach_boot_iso_if_needed_mock,
|
||||
@ -171,7 +173,8 @@ class IRMCPowerInternalMethodsTestCase(test_common.BaseIRMCTest):
|
||||
autospec=True)
|
||||
@mock.patch.object(irmc_common, 'get_irmc_client', spec_set=True,
|
||||
autospec=True)
|
||||
@mock.patch.object(irmc_boot, 'attach_boot_iso_if_needed')
|
||||
@mock.patch.object(irmc_boot, 'attach_boot_iso_if_needed',
|
||||
autospec=True)
|
||||
def test__set_power_state_soft_reboot_ok(
|
||||
self,
|
||||
attach_boot_iso_if_needed_mock,
|
||||
@ -192,7 +195,8 @@ class IRMCPowerInternalMethodsTestCase(test_common.BaseIRMCTest):
|
||||
autospec=True)
|
||||
@mock.patch.object(irmc_common, 'get_irmc_client', spec_set=True,
|
||||
autospec=True)
|
||||
@mock.patch.object(irmc_boot, 'attach_boot_iso_if_needed')
|
||||
@mock.patch.object(irmc_boot, 'attach_boot_iso_if_needed',
|
||||
autospec=True)
|
||||
def test__set_power_state_soft_power_off_ok(self,
|
||||
attach_boot_iso_if_needed_mock,
|
||||
get_irmc_client_mock,
|
||||
@ -209,7 +213,8 @@ class IRMCPowerInternalMethodsTestCase(test_common.BaseIRMCTest):
|
||||
|
||||
@mock.patch.object(irmc_power, '_wait_power_state', spec_set=True,
|
||||
autospec=True)
|
||||
@mock.patch.object(irmc_boot, 'attach_boot_iso_if_needed')
|
||||
@mock.patch.object(irmc_boot, 'attach_boot_iso_if_needed',
|
||||
autospec=True)
|
||||
def test__set_power_state_invalid_target_state(
|
||||
self,
|
||||
attach_boot_iso_if_needed_mock,
|
||||
@ -227,7 +232,8 @@ class IRMCPowerInternalMethodsTestCase(test_common.BaseIRMCTest):
|
||||
autospec=True)
|
||||
@mock.patch.object(irmc_common, 'get_irmc_client', spec_set=True,
|
||||
autospec=True)
|
||||
@mock.patch.object(irmc_boot, 'attach_boot_iso_if_needed')
|
||||
@mock.patch.object(irmc_boot, 'attach_boot_iso_if_needed',
|
||||
autospec=True)
|
||||
def test__set_power_state_scci_exception(self,
|
||||
attach_boot_iso_if_needed_mock,
|
||||
get_irmc_client_mock,
|
||||
@ -250,7 +256,8 @@ class IRMCPowerInternalMethodsTestCase(test_common.BaseIRMCTest):
|
||||
autospec=True)
|
||||
@mock.patch.object(irmc_common, 'get_irmc_client', spec_set=True,
|
||||
autospec=True)
|
||||
@mock.patch.object(irmc_boot, 'attach_boot_iso_if_needed')
|
||||
@mock.patch.object(irmc_boot, 'attach_boot_iso_if_needed',
|
||||
autospec=True)
|
||||
def test__set_power_state_snmp_exception(self,
|
||||
attach_boot_iso_if_needed_mock,
|
||||
get_irmc_client_mock,
|
||||
|
@ -138,8 +138,10 @@ class IRMCRaidConfigurationInternalMethodsTestCase(test_common.BaseIRMCTest):
|
||||
]
|
||||
}
|
||||
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_physical_disk')
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_raid_adapter')
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_physical_disk',
|
||||
autospec=True)
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_raid_adapter',
|
||||
autospec=True)
|
||||
def test___fail_validation_with_none_raid_adapter_profile(
|
||||
self, get_raid_adapter_mock, get_physical_disk_mock):
|
||||
get_raid_adapter_mock.return_value = None
|
||||
@ -158,8 +160,10 @@ class IRMCRaidConfigurationInternalMethodsTestCase(test_common.BaseIRMCTest):
|
||||
raid._validate_physical_disks,
|
||||
task.node, target_raid_config['logical_disks'])
|
||||
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_physical_disk')
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_raid_adapter')
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_physical_disk',
|
||||
autospec=True)
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_raid_adapter',
|
||||
autospec=True)
|
||||
def test___fail_validation_without_raid_level(
|
||||
self, get_raid_adapter_mock, get_physical_disk_mock):
|
||||
get_raid_adapter_mock.return_value = self.raid_adapter_profile
|
||||
@ -177,8 +181,10 @@ class IRMCRaidConfigurationInternalMethodsTestCase(test_common.BaseIRMCTest):
|
||||
raid._validate_physical_disks,
|
||||
task.node, target_raid_config['logical_disks'])
|
||||
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_physical_disk')
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_raid_adapter')
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_physical_disk',
|
||||
autospec=True)
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_raid_adapter',
|
||||
autospec=True)
|
||||
def test___fail_validation_with_raid_level_is_none(self,
|
||||
get_raid_adapter_mock,
|
||||
get_physical_disk_mock):
|
||||
@ -198,8 +204,10 @@ class IRMCRaidConfigurationInternalMethodsTestCase(test_common.BaseIRMCTest):
|
||||
raid._validate_physical_disks,
|
||||
task.node, target_raid_config['logical_disks'])
|
||||
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_physical_disk')
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_raid_adapter')
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_physical_disk',
|
||||
autospec=True)
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_raid_adapter',
|
||||
autospec=True)
|
||||
def test__fail_validation_without_physical_disks(
|
||||
self, get_raid_adapter_mock, get_physical_disk_mock):
|
||||
get_raid_adapter_mock.return_value = {
|
||||
@ -235,8 +243,10 @@ class IRMCRaidConfigurationInternalMethodsTestCase(test_common.BaseIRMCTest):
|
||||
raid._validate_physical_disks,
|
||||
task.node, target_raid_config['logical_disks'])
|
||||
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_physical_disk')
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_raid_adapter')
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_physical_disk',
|
||||
autospec=True)
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_raid_adapter',
|
||||
autospec=True)
|
||||
def test___fail_validation_with_raid_level_outside_list(
|
||||
self, get_raid_adapter_mock, get_physical_disk_mock):
|
||||
get_raid_adapter_mock.return_value = self.raid_adapter_profile
|
||||
@ -256,9 +266,12 @@ class IRMCRaidConfigurationInternalMethodsTestCase(test_common.BaseIRMCTest):
|
||||
task.node, target_raid_config['logical_disks'])
|
||||
|
||||
@mock.patch(
|
||||
'ironic.drivers.modules.irmc.raid._validate_logical_drive_capacity')
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_physical_disk')
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_raid_adapter')
|
||||
'ironic.drivers.modules.irmc.raid._validate_logical_drive_capacity',
|
||||
autospec=True)
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_physical_disk',
|
||||
autospec=True)
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_raid_adapter',
|
||||
autospec=True)
|
||||
def test__fail_validation_with_not_enough_valid_disks(
|
||||
self, get_raid_adapter_mock, get_physical_disk_mock,
|
||||
capacity_mock):
|
||||
@ -282,8 +295,10 @@ class IRMCRaidConfigurationInternalMethodsTestCase(test_common.BaseIRMCTest):
|
||||
raid._validate_physical_disks,
|
||||
task.node, target_raid_config['logical_disks'])
|
||||
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_physical_disk')
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_raid_adapter')
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_physical_disk',
|
||||
autospec=True)
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_raid_adapter',
|
||||
autospec=True)
|
||||
def test__fail_validation_with_physical_disk_insufficient(
|
||||
self, get_raid_adapter_mock, get_physical_disk_mock):
|
||||
get_raid_adapter_mock.return_value = self.raid_adapter_profile
|
||||
@ -307,8 +322,10 @@ class IRMCRaidConfigurationInternalMethodsTestCase(test_common.BaseIRMCTest):
|
||||
raid._validate_physical_disks,
|
||||
task.node, target_raid_config['logical_disks'])
|
||||
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_physical_disk')
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_raid_adapter')
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_physical_disk',
|
||||
autospec=True)
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_raid_adapter',
|
||||
autospec=True)
|
||||
def test__fail_validation_with_physical_disk_not_enough_disks(
|
||||
self, get_raid_adapter_mock, get_physical_disk_mock):
|
||||
get_raid_adapter_mock.return_value = self.raid_adapter_profile
|
||||
@ -331,8 +348,10 @@ class IRMCRaidConfigurationInternalMethodsTestCase(test_common.BaseIRMCTest):
|
||||
raid._validate_physical_disks,
|
||||
task.node, target_raid_config['logical_disks'])
|
||||
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_physical_disk')
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_raid_adapter')
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_physical_disk',
|
||||
autospec=True)
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_raid_adapter',
|
||||
autospec=True)
|
||||
def test__fail_validation_with_physical_disk_incorrect_valid_disks(
|
||||
self, get_raid_adapter_mock, get_physical_disk_mock):
|
||||
get_raid_adapter_mock.return_value = self.raid_adapter_profile
|
||||
@ -358,8 +377,10 @@ class IRMCRaidConfigurationInternalMethodsTestCase(test_common.BaseIRMCTest):
|
||||
raid._validate_physical_disks,
|
||||
task.node, target_raid_config['logical_disks'])
|
||||
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_physical_disk')
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_raid_adapter')
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_physical_disk',
|
||||
autospec=True)
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_raid_adapter',
|
||||
autospec=True)
|
||||
def test__fail_validation_with_physical_disk_outside_valid_disks_1(
|
||||
self, get_raid_adapter_mock, get_physical_disk_mock):
|
||||
get_raid_adapter_mock.return_value = self.raid_adapter_profile
|
||||
@ -383,9 +404,12 @@ class IRMCRaidConfigurationInternalMethodsTestCase(test_common.BaseIRMCTest):
|
||||
task.node, target_raid_config['logical_disks'])
|
||||
|
||||
@mock.patch(
|
||||
'ironic.drivers.modules.irmc.raid._validate_logical_drive_capacity')
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_physical_disk')
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_raid_adapter')
|
||||
'ironic.drivers.modules.irmc.raid._validate_logical_drive_capacity',
|
||||
autospec=True)
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_physical_disk',
|
||||
autospec=True)
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_raid_adapter',
|
||||
autospec=True)
|
||||
def test__fail_validation_with_physical_disk_outside_valid_slots_2(
|
||||
self, get_raid_adapter_mock, get_physical_disk_mock,
|
||||
capacity_mock):
|
||||
@ -418,9 +442,12 @@ class IRMCRaidConfigurationInternalMethodsTestCase(test_common.BaseIRMCTest):
|
||||
task.node, target_raid_config['logical_disks'])
|
||||
|
||||
@mock.patch(
|
||||
'ironic.drivers.modules.irmc.raid._validate_logical_drive_capacity')
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_physical_disk')
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_raid_adapter')
|
||||
'ironic.drivers.modules.irmc.raid._validate_logical_drive_capacity',
|
||||
autospec=True)
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_physical_disk',
|
||||
autospec=True)
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_raid_adapter',
|
||||
autospec=True)
|
||||
def test__fail_validation_with_duplicated_physical_disks(
|
||||
self, get_raid_adapter_mock, get_physical_disk_mock,
|
||||
capacity_mock):
|
||||
@ -452,7 +479,8 @@ class IRMCRaidConfigurationInternalMethodsTestCase(test_common.BaseIRMCTest):
|
||||
raid._validate_physical_disks,
|
||||
task.node, target_raid_config['logical_disks'])
|
||||
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_raid_adapter')
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_raid_adapter',
|
||||
autospec=True)
|
||||
def test__fail_validation_with_difference_physical_disks_type(
|
||||
self, get_raid_adapter_mock):
|
||||
get_raid_adapter_mock.return_value = {
|
||||
@ -573,11 +601,12 @@ class IRMCRaidConfigurationInternalMethodsTestCase(test_common.BaseIRMCTest):
|
||||
raid._validate_logical_drive_capacity,
|
||||
disk, self.valid_disk_slots)
|
||||
|
||||
@mock.patch('ironic.common.raid.update_raid_info')
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid.client')
|
||||
def test__commit_raid_config_with_logical_drives(self, client_mock,
|
||||
update_raid_info_mock):
|
||||
client_mock.elcm.get_raid_adapter.return_value = {
|
||||
@mock.patch('ironic.common.raid.update_raid_info', autospec=True)
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid.client.elcm.'
|
||||
'get_raid_adapter', autospec=True)
|
||||
def test__commit_raid_config_with_logical_drives(
|
||||
self, get_raid_adapter_mock, update_raid_info_mock):
|
||||
get_raid_adapter_mock.return_value = {
|
||||
"Server": {
|
||||
"HWConfigurationIrmc": {
|
||||
"Adapters": {
|
||||
@ -665,7 +694,7 @@ class IRMCRaidConfigurationInternalMethodsTestCase(test_common.BaseIRMCTest):
|
||||
with task_manager.acquire(self.context, self.node.uuid,
|
||||
shared=True) as task:
|
||||
raid._commit_raid_config(task)
|
||||
client_mock.elcm.get_raid_adapter.assert_called_once_with(
|
||||
get_raid_adapter_mock.assert_called_once_with(
|
||||
task.node.driver_info)
|
||||
update_raid_info_mock.assert_called_once_with(
|
||||
task.node, task.node.raid_config)
|
||||
@ -730,9 +759,12 @@ class IRMCRaidConfigurationTestCase(test_common.BaseIRMCTest):
|
||||
self.assertRaises(exception.MissingParameterValue,
|
||||
raid_configuration.create_configuration, task)
|
||||
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._validate_physical_disks')
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._create_raid_adapter')
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._commit_raid_config')
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._validate_physical_disks',
|
||||
autospec=True)
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._create_raid_adapter',
|
||||
autospec=True)
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._commit_raid_config',
|
||||
autospec=True)
|
||||
def test_create_raid_with_raid_1_and_0(self, commit_mock,
|
||||
create_raid_mock, validation_mock):
|
||||
expected_input = {
|
||||
@ -759,9 +791,12 @@ class IRMCRaidConfigurationTestCase(test_common.BaseIRMCTest):
|
||||
task.node, expected_input['logical_disks'])
|
||||
commit_mock.assert_called_once_with(task)
|
||||
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._validate_physical_disks')
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._create_raid_adapter')
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._commit_raid_config')
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._validate_physical_disks',
|
||||
autospec=True)
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._create_raid_adapter',
|
||||
autospec=True)
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._commit_raid_config',
|
||||
autospec=True)
|
||||
def test_create_raid_with_raid_5_and_0(self, commit_mock,
|
||||
create_raid_mock, validation_mock):
|
||||
expected_input = {
|
||||
@ -788,7 +823,8 @@ class IRMCRaidConfigurationTestCase(test_common.BaseIRMCTest):
|
||||
task.node, expected_input['logical_disks'])
|
||||
commit_mock.assert_called_once_with(task)
|
||||
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._delete_raid_adapter')
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._delete_raid_adapter',
|
||||
autospec=True)
|
||||
def test_delete_raid_configuration(self, delete_raid_mock):
|
||||
|
||||
with task_manager.acquire(self.context, self.node.uuid,
|
||||
@ -796,7 +832,8 @@ class IRMCRaidConfigurationTestCase(test_common.BaseIRMCTest):
|
||||
task.driver.raid.delete_configuration(task)
|
||||
delete_raid_mock.assert_called_once_with(task.node)
|
||||
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._delete_raid_adapter')
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._delete_raid_adapter',
|
||||
autospec=True)
|
||||
def test_delete_raid_configuration_return_cleared_raid_config(
|
||||
self, delete_raid_mock):
|
||||
with task_manager.acquire(self.context, self.node.uuid,
|
||||
|
1
tox.ini
1
tox.ini
@ -134,7 +134,6 @@ per-file-ignores =
|
||||
ironic/tests/unit/common/*:H210
|
||||
ironic/tests/unit/drivers/modules/test_console_utils.py:H210
|
||||
ironic/tests/unit/drivers/modules/ilo/*:H210
|
||||
ironic/tests/unit/drivers/modules/irmc/*:H210
|
||||
|
||||
[hacking]
|
||||
import_exceptions = testtools.matchers, ironic.common.i18n
|
||||
|
Loading…
x
Reference in New Issue
Block a user