test(openstack): assert get_mac propagates NotFoundError when server …#19
Merged
Conversation
…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
approved these changes
Jun 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
test_service_fixed_get_mac.pyandtest_service_get_mac.pyto expect aNotFoundErrorto be raised when the server is not found, instead of returning an empty string. This aligns test expectations with the actual behavior ofget_server_mac. [1] [2]Test setup improvements:
get_server_macfunction to the mocked API, ensuring that tests exercise the true MAC resolution code path rather than a cached or stubbed version. [1] [2]_service_with_apihelper 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]