New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support using long interface names with IPFabric #309
Conversation
@@ -83,3 +83,28 @@ def test_data_loading(self): | |||
self.assertTrue(hasattr(interface, "ip_address")) | |||
self.assertTrue(hasattr(interface, "subnet_mask")) | |||
self.assertTrue(hasattr(interface, "type")) | |||
|
|||
@patch("nautobot_ssot.integrations.ipfabric.diffsync.adapter_ipfabric.IP_FABRIC_ELONGATE_INTERFACE_NAME", True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not requiring to swap out but would be good to patch the setting instead of the constant. Should be the same net effect. TBH how we do constants for plugin config kinda negates the lazy loading part of Django settings BUT that pattern is everywhere and we don't document or expect users to relying on lazy loading
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ya, I'm not a fan either, but following convention. As for patching the setting, as far as I know, I would have to patch all of nautobot_ssot
settings, which seems a bit excessive; is there another solution?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it's a patch of all plugin config but all tests should run against the default config so if you pass in just the one toggle that's all that changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently tests are being impacted by the settings in PLUGINS_CONFIG so it might be necessary to patch the specific setting. We are planning on addressing that issue in the near future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should fix the tests to be in a state that do not have to have the settings changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree and it's on the todo list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I disagree on this one, this is testing a setting change so it should be tested from the PLUGIN_CONFIG side. Intercepting the constant definition could mask an improperly defined plugin config in the NautobotAppConfig.
I am okay resolving this item, whatever we do in the future should test making the setting change in nautobot config and not patching elsewhere. Django lazy loading + default values for plugin config + patching the constant that pulls out a value from plugin config could be a false sense of coverage. I would vote this is a feature request into the nautobot testing framework.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually, this is testing whatever the value of the constant is since that is what is imported/used. There should be a separate set of tests for constants.py that tests the constants are set correctly
1281bf9
to
2ecb5ca
Compare
eaadc6d
to
4b0d3ac
Compare
4b0d3ac
to
257210b
Compare
c749641
to
9da16ff
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
No description provided.