summaryrefslogtreecommitdiff
path: root/ironic/tests/unit/drivers/modules
diff options
context:
space:
mode:
authorDmitry Tantsur <dtantsur@protonmail.com>2022-08-15 16:42:19 +0200
committerDmitry Tantsur <dtantsur@protonmail.com>2022-08-15 16:42:19 +0200
commit89f421b166915a22626dcb919382ce13f4588973 (patch)
tree2bad92825f44b45f593fb93b5b27fa4257c7e1bd /ironic/tests/unit/drivers/modules
parent3d3a67daf7d2969d8da691d12351ab5bb32eca80 (diff)
downloadironic-89f421b166915a22626dcb919382ce13f4588973.tar.gz
Do not reboot into nowhere after BIOS settings with fast-track
Currently, the prepare_ramdisk implementation of the redfish-virtual-media boot interface skips configuring an ISO in fast-track mode. When rebooting after BIOS/RAID settings changes, we need to enforce the correct ISO configuration. Change-Id: Ibdfe0775065f3b27478305dd18929a291df3ee3c
Diffstat (limited to 'ironic/tests/unit/drivers/modules')
-rw-r--r--ironic/tests/unit/drivers/modules/redfish/test_bios.py32
1 files changed, 28 insertions, 4 deletions
diff --git a/ironic/tests/unit/drivers/modules/redfish/test_bios.py b/ironic/tests/unit/drivers/modules/redfish/test_bios.py
index cd6f9be5f..f9146f3b6 100644
--- a/ironic/tests/unit/drivers/modules/redfish/test_bios.py
+++ b/ironic/tests/unit/drivers/modules/redfish/test_bios.py
@@ -165,13 +165,16 @@ class RedfishBiosTestCase(db_base.DbTestCase):
mock_setting_list.delete.assert_called_once_with(
task.context, task.node.id, delete_names)
+ @mock.patch.object(manager_utils, 'is_fast_track', autospec=True)
@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_step_pre_reboot(self, mock_power_action, mock_get_system,
- mock_build_agent_options, mock_prepare):
+ mock_build_agent_options, mock_prepare,
+ mock_fast_track, fast_track=False):
+ mock_fast_track.return_value = fast_track
if self.node.clean_step:
step_data = self.node.clean_step
check_fields = ['cleaning_reboot', 'skip_current_clean_step']
@@ -197,7 +200,13 @@ class RedfishBiosTestCase(db_base.DbTestCase):
bios.supported_apply_times = []
ret = task.driver.bios.apply_configuration(task, data)
mock_get_system.assert_called_with(task.node)
- mock_power_action.assert_called_once_with(task, states.REBOOT)
+ if fast_track:
+ mock_power_action.assert_has_calls([
+ mock.call(task, states.POWER_OFF),
+ mock.call(task, states.REBOOT),
+ ])
+ else:
+ mock_power_action.assert_called_once_with(task, states.REBOOT)
if step == 'factory_reset':
bios.reset_bios.assert_called_once()
if step == 'apply_configuration':
@@ -205,8 +214,8 @@ class RedfishBiosTestCase(db_base.DbTestCase):
attributes, apply_time=None)
mock_build_agent_options.assert_called_once_with(task.node)
mock_prepare.assert_called_once_with(mock.ANY, task, {'a': 'b'})
- info = task.node.driver_internal_info
- self.assertTrue(all(x in info for x in check_fields))
+ for field in check_fields:
+ self.assertIn(field, task.node.driver_internal_info)
self.assertEqual(expected_ret, ret)
def test_factory_reset_step_pre_reboot_cleaning(self):
@@ -221,6 +230,12 @@ class RedfishBiosTestCase(db_base.DbTestCase):
self.node.save()
self._test_step_pre_reboot()
+ def test_factory_reset_step_pre_reboot_fast_track(self):
+ self.node.clean_step = {'priority': 100, 'interface': 'bios',
+ 'step': 'factory_reset', 'argsinfo': {}}
+ self.node.save()
+ self._test_step_pre_reboot(fast_track=True)
+
def test_apply_conf_step_pre_reboot_cleaning(self):
data = [{'name': 'ProcTurboMode', 'value': 'Disabled'},
{'name': 'NicBoot1', 'value': 'NetworkBoot'}]
@@ -239,6 +254,15 @@ class RedfishBiosTestCase(db_base.DbTestCase):
self.node.save()
self._test_step_pre_reboot()
+ def test_apply_conf_step_pre_reboot_fast_track(self):
+ data = [{'name': 'ProcTurboMode', 'value': 'Disabled'},
+ {'name': 'NicBoot1', 'value': 'NetworkBoot'}]
+ self.node.clean_step = {'priority': 100, 'interface': 'bios',
+ 'step': 'apply_configuration',
+ 'argsinfo': {'settings': data}}
+ self.node.save()
+ self._test_step_pre_reboot(fast_track=True)
+
@mock.patch.object(redfish_utils, 'get_system', autospec=True)
def _test_step_post_reboot(self, mock_get_system,
attributes_after_reboot=None):