commit f103ce48ca60e12952be7aa6d5183f64ef826370
Author: Sam Betts <email address hidden>
Date: Wed Aug 6 00:05:05 2014 +0100
Predictable field and filter ordering
This fixes the fields and filters units tests that break with a
randomized PYTHONHASHSEED (see the bug report).
The RESOURCE_ATTRIBUTE_MAP is stored as a dict leading to an
unpredictable output order. Values in kvp strings are being stored as
sets underpinned by dicts when converted, leading to unpredictable
ordering of values when read.
Discovered with PYTHONHASHSEED = 2455351445 on these tests:
test_api_v2.APIv2TestCase.test_fields
test_api_v2.APIv2TestCase.test_fields_multiple
test_api_v2.FiltersTestCase.test_attr_info_with_convert_list_to
test_api_v2.APIv2TestCase.test_filters_with_fields
test_api_v2.APIv2TestCase.test_fields_multiple_with_empty
There are 3 parts to this fix:
1. Update the APIv2TestCase _do_field_list function to construct
field list in the same order as the controller constructs its list.
2. Ensure the APIv2TestCase _get_collection_kwargs maintains order
throughout.
3. Use new assertOrderedEqual function to sort values before assertion
in test_attr_info_with_convert_list_to
Reviewed: https:/ /review. openstack. org/112258 /git.openstack. org/cgit/ openstack/ neutron/ commit/ ?id=f103ce48ca6 0e12952be7aa6d5 183f64ef826370
Committed: https:/
Submitter: Jenkins
Branch: master
commit f103ce48ca60e12 952be7aa6d5183f 64ef826370
Author: Sam Betts <email address hidden>
Date: Wed Aug 6 00:05:05 2014 +0100
Predictable field and filter ordering
This fixes the fields and filters units tests that break with a
randomized PYTHONHASHSEED (see the bug report).
The RESOURCE_ ATTRIBUTE_ MAP is stored as a dict leading to an
unpredictable output order. Values in kvp strings are being stored as
sets underpinned by dicts when converted, leading to unpredictable
ordering of values when read.
Discovered with PYTHONHASHSEED = 2455351445 on these tests: api_v2. APIv2TestCase. test_fields api_v2. APIv2TestCase. test_fields_ multiple api_v2. FiltersTestCase .test_attr_ info_with_ convert_ list_to api_v2. APIv2TestCase. test_filters_ with_fields api_v2. APIv2TestCase. test_fields_ multiple_ with_empty
test_
test_
test_
test_
test_
There are 3 parts to this fix: _kwargs maintains order info_with_ convert_ list_to
1. Update the APIv2TestCase _do_field_list function to construct
field list in the same order as the controller constructs its list.
2. Ensure the APIv2TestCase _get_collection
throughout.
3. Use new assertOrderedEqual function to sort values before assertion
in test_attr_
Change-Id: I547cfa80cf83b0 340b459279df928 3443562326b
Partial-bug: #1348818