]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commit
Do not assume order of get_sync_data_metering response elements
authorCedric Brandily <zzelle@gmail.com>
Tue, 26 May 2015 22:23:09 +0000 (00:23 +0200)
committerCedric Brandily <zzelle@gmail.com>
Wed, 27 May 2015 06:37:20 +0000 (08:37 +0200)
commit539738a8eeebcc9f22987fcb0a241c6b8c3d561a
treea02c649df2449b99abf5354f01ebc4e8b2feefc0
parent420ca31da23cfe9a49b128cbce2d0b7cd9388974
Do not assume order of get_sync_data_metering response elements

This fixes the test_add_metering_label_rpc_call[1] unit tests that breaks
with a randomized PYTHONHASHSEED (see the bug report).

The test assumed that the get_sync_data_metering[2] had response
elements in a particular order. Found with PYTHONHASHSEED=1.

The fix refactors the test_add_metering_label_rpc_call test case to handle
an unsorted get_sync_data_metering response. The fix defines the class
UnorderedList[3] which is equal to any permutation of itself.

Partial-bug: #1348818

Note: There are several other unrelated unit tests that also break with
a randomized PYTHONHASHSEED, but they are not addressed here. They will
be addressed in separate patches.

[1] neutron.tests.unit.services.metering.test_metering_plugin:
 TestMeteringPluginL3AgentScheduler
 TestMeteringPluginL3AgentSchedulerServicePlugin
[2] neutron.services.metering.metering_plugin.MeteringPlugin
[3] neutron.tests.tools

Change-Id: I5d42b827bc72dcacd38eaa2377ce16c47a9e7dbb
neutron/tests/tools.py
neutron/tests/unit/services/metering/test_metering_plugin.py