diff options
author | Aija Jauntēva <aija.jaunteva@dell.com> | 2020-09-23 09:19:19 -0400 |
---|---|---|
committer | Aija Jauntēva <aija.jaunteva@dell.com> | 2020-09-23 14:00:08 -0400 |
commit | 1a9020deb1399af4c9014d1816c2f16592e40947 (patch) | |
tree | 88b86a049f3fa07b08a15c430a3cbf4aa615bfa5 /ironic/tests | |
parent | 65d50663941ffe66be587e09d0c63528f970dabd (diff) | |
download | ironic-1a9020deb1399af4c9014d1816c2f16592e40947.tar.gz |
Update tests for Redfish BIOS apply_configuration
Add new test case when supported_apply_times is None.
Clean up existing apply_configuration tests to not set up
bios.apply_time_settings as it is no longer used in implementation
and repurpose it for current implementation.
Co-Authored-By: Eric Barrera <eric_barrera@dell.com>
Co-Authored-By: Richard G. Pioso <richard.pioso@dell.com>
Co-Authored-By: Mike Raineri <mraineri@gmail.com>
Followup to I28a948f306b40c36b12e6f786e1e43a61e84a0f2
Change-Id: I923559c0dc60b1e618584b9dd7a1bf4ac6decb7f
Diffstat (limited to 'ironic/tests')
-rw-r--r-- | ironic/tests/unit/drivers/modules/redfish/test_bios.py | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/ironic/tests/unit/drivers/modules/redfish/test_bios.py b/ironic/tests/unit/drivers/modules/redfish/test_bios.py index d9c2a1453..95c61ee76 100644 --- a/ironic/tests/unit/drivers/modules/redfish/test_bios.py +++ b/ironic/tests/unit/drivers/modules/redfish/test_bios.py @@ -190,7 +190,6 @@ class RedfishBiosTestCase(db_base.DbTestCase): if step == 'factory_reset': ret = task.driver.bios.factory_reset(task) if step == 'apply_configuration': - bios.apply_time_settings = None bios.supported_apply_times = [] ret = task.driver.bios.apply_configuration(task, data) mock_get_system.assert_called_with(task.node) @@ -387,16 +386,15 @@ class RedfishBiosTestCase(db_base.DbTestCase): @mock.patch.object(deploy_utils, 'build_agent_options', autospec=True) @mock.patch.object(redfish_utils, 'get_system', autospec=True) @mock.patch.object(manager_utils, 'node_power_action', autospec=True) - def test_apply_configuration_apply_time_settings(self, mock_power_action, - mock_get_system, - mock_build_agent_options, - mock_prepare): + def test_apply_configuration_apply_time_immediate(self, mock_power_action, + mock_get_system, + mock_build_agent_options, + mock_prepare): settings = [{'name': 'ProcTurboMode', 'value': 'Disabled'}, {'name': 'NicBoot1', 'value': 'NetworkBoot'}] with task_manager.acquire(self.context, self.node.uuid, shared=False) as task: bios = mock_get_system(task.node).bios - bios.apply_time_settings = mock.Mock() bios.supported_apply_times = ['immediate'] task.driver.bios.apply_configuration(task, settings) @@ -419,7 +417,6 @@ class RedfishBiosTestCase(db_base.DbTestCase): with task_manager.acquire(self.context, self.node.uuid, shared=False) as task: bios = mock_get_system(task.node).bios - bios.apply_time_settings = None bios.supported_apply_times = [sushy.APPLY_TIME_ON_RESET] task.driver.bios.apply_configuration(task, settings) @@ -427,3 +424,24 @@ class RedfishBiosTestCase(db_base.DbTestCase): bios.set_attributes.assert_called_once_with( {s['name']: s['value'] for s in settings}, apply_time=sushy.APPLY_TIME_ON_RESET) + + @mock.patch.object(redfish_boot.RedfishVirtualMediaBoot, 'prepare_ramdisk', + spec_set=True, autospec=True) + @mock.patch.object(deploy_utils, 'build_agent_options', autospec=True) + @mock.patch.object(redfish_utils, 'get_system', autospec=True) + @mock.patch.object(manager_utils, 'node_power_action', autospec=True) + def test_apply_configuration_no_supported_apply_times( + self, mock_power_action, mock_get_system, mock_build_agent_options, + mock_prepare): + settings = [{'name': 'ProcTurboMode', 'value': 'Disabled'}, + {'name': 'NicBoot1', 'value': 'NetworkBoot'}] + with task_manager.acquire(self.context, self.node.uuid, + shared=False) as task: + bios = mock_get_system(task.node).bios + bios.supported_apply_times = None + + task.driver.bios.apply_configuration(task, settings) + + bios.set_attributes.assert_called_once_with( + {s['name']: s['value'] for s in settings}, + apply_time=None) |