summaryrefslogtreecommitdiff
path: root/ironic/tests/unit/drivers/modules/redfish/test_management.py
diff options
context:
space:
mode:
authorVanou Ishii <ishii.vanou@fujitsu.com>2022-08-05 16:58:32 +0900
committerVanou Ishii <ishii.vanou@fujitsu.com>2022-08-09 15:35:52 +0900
commit3b28d0984d5eb82320c632dd5840cebf6d0762ad (patch)
tree367672f6dffedfd201df7993971c9e6ca6bd39b8 /ironic/tests/unit/drivers/modules/redfish/test_management.py
parent45c9c3029f5363b6e24e578648c09213a7338db1 (diff)
downloadironic-3b28d0984d5eb82320c632dd5840cebf6d0762ad.tar.gz
Modify test code to avoid CONF modification affection
Few unit tests change attribute of CONF variable via Python assignment. This changes attribute of CONF, which is instance of XxxOpt class defined in oslo_config, to Python literal value. This affects result of another unit test. To avoid this, we should change attribute of CONF variable with set_override method. Change-Id: I4bd8b1b4ea974834f1149fcaa79de85d24f5f7d1 Story: 2010214 Task: 45956 Depends-On: https://review.opendev.org/c/openstack/ironic/+/852253
Diffstat (limited to 'ironic/tests/unit/drivers/modules/redfish/test_management.py')
-rw-r--r--ironic/tests/unit/drivers/modules/redfish/test_management.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/ironic/tests/unit/drivers/modules/redfish/test_management.py b/ironic/tests/unit/drivers/modules/redfish/test_management.py
index 93aae5de8..f8c82949a 100644
--- a/ironic/tests/unit/drivers/modules/redfish/test_management.py
+++ b/ironic/tests/unit/drivers/modules/redfish/test_management.py
@@ -836,7 +836,7 @@ class RedfishManagementTestCase(db_base.DbTestCase):
mock_update_service = mock.Mock()
mock_update_service.simple_update.return_value = mock_task_monitor
mock_get_update_service.return_value = mock_update_service
- CONF.redfish.firmware_source = 'http'
+ CONF.set_override('firmware_source', 'http', 'redfish')
with task_manager.acquire(self.context, self.node.uuid,
shared=False) as task:
task.node.save = mock.Mock()
@@ -1346,7 +1346,7 @@ class RedfishManagementTestCase(db_base.DbTestCase):
{'task_monitor': '/task/123', 'url': 'http://test1'},
{'url': 'http://test2'}]}
self.node.driver_internal_info = driver_internal_info
- CONF.redfish.firmware_source = 'http'
+ CONF.set_override('firmware_source', 'http', 'redfish')
management = redfish_mgmt.RedfishManagement()
with task_manager.acquire(self.context, self.node.uuid,
@@ -1375,7 +1375,7 @@ class RedfishManagementTestCase(db_base.DbTestCase):
@mock.patch.object(firmware_utils, 'stage', autospec=True)
def test__stage_firmware_file_https(self, mock_stage, mock_verify_checksum,
mock_download_to_temp):
- CONF.redfish.firmware_source = 'local'
+ CONF.set_override('firmware_source', 'local', 'redfish')
firmware_update = {'url': 'https://test1', 'checksum': 'abc'}
node = mock.Mock()
mock_download_to_temp.return_value = '/tmp/test1'
@@ -1399,7 +1399,7 @@ class RedfishManagementTestCase(db_base.DbTestCase):
def test__stage_firmware_file_swift(
self, mock_get_swift_temp_url, mock_stage, mock_verify_checksum,
mock_download_to_temp):
- CONF.redfish.firmware_source = 'swift'
+ CONF.set_override('firmware_source', 'swift', 'redfish')
firmware_update = {'url': 'swift://container/bios.exe'}
node = mock.Mock()
mock_get_swift_temp_url.return_value = 'http://temp'
@@ -1423,7 +1423,7 @@ class RedfishManagementTestCase(db_base.DbTestCase):
mock_download_to_temp, mock_cleanup):
node = mock.Mock()
firmware_update = {'url': 'https://test1'}
- CONF.redfish.firmware_source = 'local'
+ CONF.set_override('firmware_source', 'local', 'redfish')
firmware_update = {'url': 'https://test1'}
node = mock.Mock()
mock_download_to_temp.return_value = '/tmp/test1'