summaryrefslogtreecommitdiff
path: root/ironic/tests/unit/conductor/test_manager.py
diff options
context:
space:
mode:
authorSteve Baker <sbaker@redhat.com>2021-11-19 09:52:53 +1300
committerSteve Baker <sbaker@redhat.com>2021-12-03 14:49:33 +1300
commitd5eb6ee567befb36b2c353d002cbe25c83365e2a (patch)
tree2c0f5c0db583decaa73978520b761d6c63eca535 /ironic/tests/unit/conductor/test_manager.py
parent3197301dbab1be5500cd820c503717e64953cd95 (diff)
downloadironic-d5eb6ee567befb36b2c353d002cbe25c83365e2a.tar.gz
Refactor driver_internal_info updates to methods
Making updates to driver_internal_info can result in hard to read code due the requirement to assign the whole driver_internal_info back to the node to trigger the expected update operation. This change replaces driver_internal_info update operations with a new methods: - set_driver_internal_info - del_driver_internal_info - timestamp_driver_internal_info This change defines the functions and moves core conductor logic to use them. Subsequent changes in this series will move drivers to use the new functions. Change-Id: Ib8917c3c674e77cd3aba6a1e73c65162e3ee1141
Diffstat (limited to 'ironic/tests/unit/conductor/test_manager.py')
-rw-r--r--ironic/tests/unit/conductor/test_manager.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/ironic/tests/unit/conductor/test_manager.py b/ironic/tests/unit/conductor/test_manager.py
index a00bb97f8..da1d7574d 100644
--- a/ironic/tests/unit/conductor/test_manager.py
+++ b/ironic/tests/unit/conductor/test_manager.py
@@ -3059,8 +3059,12 @@ class DoNodeRescueTestCase(mgr_utils.CommonMixIn, mgr_utils.ServiceSetUpMixin,
err_handler=conductor_utils.spawn_rescue_error_handler)
self.assertIn('rescue_password', task.node.instance_info)
self.assertIn('hashed_rescue_password', task.node.instance_info)
- self.assertEqual({'other field': 'value'},
- task.node.driver_internal_info)
+ task.node.del_driver_internal_info.assert_has_calls([
+ mock.call('agent_secret_token'),
+ mock.call('agent_secret_token_pregenerated'),
+ mock.call('agent_url'),
+ mock.call('agent_verify_ca')
+ ])
def test_do_node_rescue_invalid_state(self):
self._start_service()
@@ -3212,7 +3216,9 @@ class DoNodeRescueTestCase(mgr_utils.CommonMixIn, mgr_utils.ServiceSetUpMixin,
mock_acquire.side_effect = self._get_acquire_side_effect(task)
self.service.do_node_unrescue(self.context, task.node.uuid)
task.node.refresh()
- self.assertNotIn('agent_url', task.node.driver_internal_info)
+ task.node.del_driver_internal_info.assert_has_calls([
+ mock.call('agent_url')
+ ])
task.process_event.assert_called_once_with(
'unrescue',
callback=self.service._spawn_worker,