From: Eric Harney Date: Thu, 19 Mar 2015 16:27:59 +0000 (-0400) Subject: Tests: Fix az test failure when PYTHONHASHSEED != 0 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=2c50eadb822953c0d945dfd6e922dcdede7ab2ce;p=openstack-build%2Fcinder-build.git Tests: Fix az test failure when PYTHONHASHSEED != 0 The test_list_availability_zones_enabled_service test calls a method which returns a tuple that is generated from a dict. This is compared to a tuple in the test, which can fail when PYTHONHASHSEED is not 0, due to the tuples containing elements in different orders. (Because the dict used to build the tuple was ordered differently.) For this test, we can convert to lists and sort them to do the comparison, since the ordering is not important. Partial-Bug: #1348818 Change-Id: Ib7e5d59073e5e243450e28492d68942f6088bb5f --- diff --git a/cinder/tests/test_volume.py b/cinder/tests/test_volume.py index f10ea2302..537373543 100644 --- a/cinder/tests/test_volume.py +++ b/cinder/tests/test_volume.py @@ -3507,12 +3507,13 @@ class VolumeTestCase(BaseVolumeTestCase): volume_api = cinder.volume.api.API() azs = volume_api.list_availability_zones() + azs = list(azs).sort() - expected = ( + expected = [ {'name': 'pung', 'available': False}, {'name': 'pong', 'available': True}, {'name': 'ping', 'available': True}, - ) + ].sort() self.assertEqual(expected, azs) diff --git a/cinder/volume/api.py b/cinder/volume/api.py index da9753e7f..8a2874e2b 100644 --- a/cinder/volume/api.py +++ b/cinder/volume/api.py @@ -122,7 +122,7 @@ class API(base.Base): def list_availability_zones(self, enable_cache=False): """Describe the known availability zones - :retval list of dicts, each with a 'name' and 'available' key + :retval tuple of dicts, each with a 'name' and 'available' key """ refresh_cache = False if enable_cache: