From fabee558282095acaa9dc5d9e6705af2e7f5f01f Mon Sep 17 00:00:00 2001 From: Eric Harney Date: Mon, 23 Jan 2017 10:58:28 -0500 Subject: [PATCH] Test: Fix assert_has_calls dict order bug (QoS) assert_has_calls assumes that calls come in a particular order by default, but the order here is not actually predictable. This test will currently fail if Python hash seed randomization is enabled. Change-Id: I0bba326b88ba97f17ec1824c4d6ea78110ff5954 --- cinder/tests/unit/objects/test_qos.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cinder/tests/unit/objects/test_qos.py b/cinder/tests/unit/objects/test_qos.py index cb88b2f4ce4..8f900d24d41 100644 --- a/cinder/tests/unit/objects/test_qos.py +++ b/cinder/tests/unit/objects/test_qos.py @@ -78,7 +78,8 @@ class TestQos(test_objects.BaseObjectsTestCase): 'consumer': 'back-end'}) qos_fake_delete.assert_has_calls([ mock.call(self.context, fake.OBJECT_ID, 'key_to_remove1'), - mock.call(self.context, fake.OBJECT_ID, 'key_to_remove2')]) + mock.call(self.context, fake.OBJECT_ID, 'key_to_remove2')], + any_order=True) @mock.patch('oslo_utils.timeutils.utcnow', return_value=timeutils.utcnow()) @mock.patch('cinder.objects.VolumeTypeList.get_all_types_for_qos',