Fixed test_compare_volume_stats_values false failures
In case of several cinder_volumes, and multiple backends, we may get
results in unpredictable order, which makes test to fail.
Now we order list before comparison to get rid of such errors.
Another way is transforamtion to sets, but it will drop same tuples.
Example of the problem:
testtools.matchers._impl.MismatchError: !=:
reference = [(u'Open Source', u'ceph-hdd', u'ceph'),
(u'Open Source', u'ceph-ssd', 'ceph'),
(u'Open Source', u'ceph-ssd', 'ceph'),
(u'Open Source', u'ceph-hdd', 'ceph')]
actual = [(u'Open Source', u'ceph-hdd', u'ceph'),
(u'Open Source', u'ceph-ssd', 'ceph'),
(u'Open Source', u'ceph-hdd', 'ceph'),
(u'Open Source', u'ceph-ssd', 'ceph')]
Change-Id: Ibd8a56368ec0091c106f31a3395c9dd313fda650
diff --git a/tempest/api/volume/admin/test_backends_capabilities.py b/tempest/api/volume/admin/test_backends_capabilities.py
index 607fc43..affed6b 100644
--- a/tempest/api/volume/admin/test_backends_capabilities.py
+++ b/tempest/api/volume/admin/test_backends_capabilities.py
@@ -72,8 +72,8 @@
]
# Returns a tuple of VOLUME_STATS values
- expected_list = list(map(operator.itemgetter(*VOLUME_STATS),
- cinder_pools))
- observed_list = list(map(operator.itemgetter(*VOLUME_STATS),
- capabilities))
+ expected_list = sorted(list(map(operator.itemgetter(*VOLUME_STATS),
+ cinder_pools)))
+ observed_list = sorted(list(map(operator.itemgetter(*VOLUME_STATS),
+ capabilities)))
self.assertEqual(expected_list, observed_list)