From 5c462987d22e9f31e6cf2fbd7e6dc19b43ad6f76 Mon Sep 17 00:00:00 2001 From: Chuck Short Date: Sun, 13 Oct 2013 08:36:03 -0400 Subject: [PATCH] python3: sort dict for post_volumes_1234_action test In Python 3, hash randomization is enabled by default. It causes the iteration order of dicts and sets to be unpredictable and differ across Python runs. Sort the list and update the expecting result. Change-Id: Iead7ca8f45b035abd78f0b25865b5f7e1b9f3294 Signed-off-by: Chuck Short --- cinderclient/tests/v1/fakes.py | 3 ++- cinderclient/tests/v2/fakes.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cinderclient/tests/v1/fakes.py b/cinderclient/tests/v1/fakes.py index cea11a3..84bbbd4 100644 --- a/cinderclient/tests/v1/fakes.py +++ b/cinderclient/tests/v1/fakes.py @@ -316,7 +316,8 @@ class FakeHTTPClient(base_client.HTTPClient): assert len(list(body)) == 1 action = list(body)[0] if action == 'os-attach': - assert list(body[action]) == ['instance_uuid', 'mountpoint'] + assert sorted(list(body[action])) == ['instance_uuid', + 'mountpoint'] elif action == 'os-detach': assert body[action] is None elif action == 'os-reserve': diff --git a/cinderclient/tests/v2/fakes.py b/cinderclient/tests/v2/fakes.py index f848512..aa235d9 100644 --- a/cinderclient/tests/v2/fakes.py +++ b/cinderclient/tests/v2/fakes.py @@ -323,7 +323,8 @@ class FakeHTTPClient(base_client.HTTPClient): assert len(list(body)) == 1 action = list(body)[0] if action == 'os-attach': - assert list(body[action]) == ['instance_uuid', 'mountpoint'] + assert sorted(list(body[action])) == ['instance_uuid', + 'mountpoint'] elif action == 'os-detach': assert body[action] is None elif action == 'os-reserve':