Skip to content

test(openstack): assert get_mac propagates NotFoundError when server …#19

Merged
dkmstr merged 1 commit into
masterfrom
fix/openstack-mac-external-dhcp
Jun 17, 2026
Merged

test(openstack): assert get_mac propagates NotFoundError when server …#19
dkmstr merged 1 commit into
masterfrom
fix/openstack-mac-external-dhcp

Conversation

@aschumann-virtualcable

Copy link
Copy Markdown
Contributor

This pull request updates unit tests for the OpenStack service MAC address resolution logic to better reflect the current behavior of the code. The main changes ensure that tests expect a NotFoundError to be raised when a server is missing, rather than returning an empty string, and they improve the way the real, undecorated MAC resolution logic is exercised in tests.

Test behavior updates:

  • Changed tests in both test_service_fixed_get_mac.py and test_service_get_mac.py to expect a NotFoundError to be raised when the server is not found, instead of returning an empty string. This aligns test expectations with the actual behavior of get_server_mac. [1] [2]

Test setup improvements:

  • Added logic in both test files to bind the real, undecorated get_server_mac function to the mocked API, ensuring that tests exercise the true MAC resolution code path rather than a cached or stubbed version. [1] [2]
  • Updated the _service_with_api helper in both test files to use the new binding logic, so that the service under test delegates to the real MAC resolution logic during tests. [1] [2]

…not found

Drive the real client.get_server_mac resolution logic through the mocked api
(via __wrapped__, bypassing the cached DB backend) instead of a bare MagicMock,
so the service-level get_mac tests exercise actual behaviour. Align the
server-not-found cases with the implementation, which only guards the Neutron
port lookup and lets NotFoundError reach the caller.
@dkmstr dkmstr merged commit b6eafd0 into master Jun 17, 2026
4 of 5 checks passed
@dkmstr dkmstr deleted the fix/openstack-mac-external-dhcp branch June 17, 2026 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants