Tests: Fix Storpool tests hash randomization failure
Dicts are unordered types, these unit tests will
fail when Python 3 hash randomization is enabled.
Needed-By:
@@ -20,6 +20,7 @@ import sys
import ddt
import mock
from oslo_utils import units
+import six
fakeStorPool = mock.Mock()
@@ -259,7 +260,7 @@ class StorPoolTestCase(test.TestCase):
self.driver.create_volume({'id': '1', 'name': 'v1', 'size': 1,
'volume_type': None})
- self.assertListEqual([volumeName('1')], list(volumes.keys()))
+ six.assertCountEqual(self, [volumeName('1')], volumes.keys())
self.assertVolumeNames(('1',))
v = volumes[volumeName('1')]
self.assertEqual(1 * units.Gi, v['size'])
@@ -333,8 +334,9 @@ class StorPoolTestCase(test.TestCase):
'volume_type': None})
self.driver.create_volume({'id': '2', 'name': 'v2', 'size': 1,
'volume_type': None})
- self.assertListEqual([volumeName('1'), volumeName('2')],
- list(volumes.keys()))
+ six.assertCountEqual(self,
+ [volumeName('1'), volumeName('2')],
+ volumes.keys())
self.assertVolumeNames(('1', '2',))
# Failure: the "migrated" volume does not even exist
@@ -354,8 +356,9 @@ class StorPoolTestCase(test.TestCase):
{'id': '2', '_name_id': '3'},
'available')
self.assertDictEqual({'_name_id': None}, res)
- self.assertListEqual([volumeName('1'), volumeName('3')],
- list(volumes.keys()))
+ six.assertCountEqual(self,
+ [volumeName('1'), volumeName('3')],
+ volumes.keys())
self.assertVolumeNames(('1', '3',))
for vid in ('1', '3'):
