summaryrefslogtreecommitdiff
path: root/ironic/tests/unit/drivers/modules/network/test_common.py
diff options
context:
space:
mode:
authorJulia Kreger <juliaashleykreger@gmail.com>2023-05-08 11:03:27 -0700
committerJulia Kreger <juliaashleykreger@gmail.com>2023-05-08 11:03:27 -0700
commit4518577770bb16cc2e4042014509cc08914796d9 (patch)
tree66a58b29bd204373c28c23928b2969d6c136b85c /ironic/tests/unit/drivers/modules/network/test_common.py
parent47b778977c7d0224d55a5416f57a0bb36fa188e8 (diff)
downloadironic-4518577770bb16cc2e4042014509cc08914796d9.tar.gz
CI: Modify dhcp client ID fail
The test, periodically under certian CI race conditions, may be handled as if there was not a change, which breaks the test as it does not save a modified port, it uses the in-flight list of changes to determine the correct path. The challenge is, the list of changes may not reconize there has been a change with the underlying object/db layer. So instead of re-test the library code, we just force the behavior by replacing the method on the object in the test, as the undrelying method being tested is tested as part of the oslo versioned objects code base. Change-Id: Ic8f9b2384ab2f8f76299afce9806fbe93e350f0e
Diffstat (limited to 'ironic/tests/unit/drivers/modules/network/test_common.py')
-rw-r--r--ironic/tests/unit/drivers/modules/network/test_common.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/ironic/tests/unit/drivers/modules/network/test_common.py b/ironic/tests/unit/drivers/modules/network/test_common.py
index 7b907ad22..48be8ceae 100644
--- a/ironic/tests/unit/drivers/modules/network/test_common.py
+++ b/ironic/tests/unit/drivers/modules/network/test_common.py
@@ -1087,14 +1087,16 @@ class TestNeutronVifPortIDMixin(db_base.DbTestCase):
def test_port_changed_client_id_fail(self, dhcp_update_mock):
self.port.internal_info = {'tenant_vif_port_id': 'fake-id'}
self.port.extra = {'client-id': 'fake3'}
- # NOTE(TheJulia): Does not save, because it attempts to figure
- # out what has changed as part of the test.
+ what_changed_mock = mock.Mock()
+ what_changed_mock.return_value = ['extra']
+ self.port.obj_what_changed = what_changed_mock
dhcp_update_mock.side_effect = (
exception.FailedToUpdateDHCPOptOnPort(port_id=self.port.uuid))
with task_manager.acquire(self.context, self.node.id) as task:
self.assertRaises(exception.FailedToUpdateDHCPOptOnPort,
self.interface.port_changed,
task, self.port)
+ self.assertEqual(2, what_changed_mock.call_count)
@mock.patch('ironic.dhcp.neutron.NeutronDHCPApi.update_port_dhcp_opts',
autospec=True)