]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Sort list of cinder_object.changes
authorThang Pham <thang.g.pham@gmail.com>
Wed, 25 Mar 2015 14:54:23 +0000 (10:54 -0400)
committerThang Pham <thang.g.pham@gmail.com>
Wed, 25 Mar 2015 14:54:23 +0000 (10:54 -0400)
If PYTHONHASHSEED is set to a non-zero value,
test_objects.TestObject.test_base_attributes unit test
fails.  This is because 'cinder_object.changes' key is
an unsorted list when the object is converted to a
primitive.  The following patch fixes this by sorting
cinder_object.changes.

Change-Id: I3a80396c5c897de26e982fa6426e7720a09c1375
Closes-Bug: #1434154

cinder/objects/base.py
cinder/tests/objects/test_objects.py

index 38cd679b80d9d334de43d6bf9a975fab467002ae..23d66322b5db7ce91aebf04c0723818d47f1b8f5 100644 (file)
@@ -482,7 +482,7 @@ class CinderObject(object):
                'cinder_object.version': target_version or self.VERSION,
                'cinder_object.data': primitive}
         if self.obj_what_changed():
-            obj['cinder_object.changes'] = list(self.obj_what_changed())
+            obj['cinder_object.changes'] = sorted(self.obj_what_changed())
         return obj
 
     def obj_set_defaults(self, *attrs):
index 2758dba342cce4e9a67eafe0af71324b561b895e..6fe798886f741bd6862d6e46ea4541ffd909273c 100644 (file)
@@ -578,7 +578,7 @@ class _TestObject(object):
                     'cinder_object.namespace': 'cinder',
                     'cinder_object.version': '1.6',
                     'cinder_object.changes':
-                        ['deleted', 'created_at', 'deleted_at', 'updated_at'],
+                        ['created_at', 'deleted', 'deleted_at', 'updated_at'],
                     'cinder_object.data':
                         {'created_at': timeutils.isotime(dt),
                          'updated_at': timeutils.isotime(dt),