[openstack-dev] [neutron][osc] Openstack client, unit tests & creating default empty values
Van Leeuwen, Robert
rovanleeuwen at ebay.com
Mon May 1 10:37:54 UTC 2017
Hello,
The unit test for the network/v2/fakes.py for the port creates empty dictionaries e.g. for allowed_address_pairs:
port_attrs = {
'admin_state_up': True,
'allowed_address_pairs': [{}],
'binding:host_id': 'binding-host-id-' + uuid.uuid4().hex,
'binding:profile': {},
In practice this value is actually “none” if someone (or nova for that matter) creates the port without specifying anything.
This allowed for at least one bug I hit, which will traceback with 'NoneType' object is not iterable:
https://review.openstack.org/#/c/461354/
I wonder how the unit tests should be modified to actually catch these things?
I can modify fakes.py to exclude the 'allowed_address_pairs': [{}]
However these issues might be in more places so it might require a more generic approach.
What is the opinion on this?
Note that:
- I did not test against trunk neutron so maybe trunk behavior is different in always returning an empty dict ?
- neutron cli used to work without this issue
Thx,
Robert van Leeuwen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20170501/66b6e6be/attachment.html>
More information about the OpenStack-dev
mailing list