Add locking to test_list_hosts_with_zone
test_list_hosts_with_zone() makes 2 list_hosts calls and expects that
the hosts' availability zone will remain constant between the calls.
However when running in parallel there is no guarantee of this, and
the aggregates tests will change the compute host's availability
zone. This commit adds the 'availability_zone' to the test to ensure
it doesn't run at the same time as the tests which will change the
host's availability zone.
Fixes bug 1228225
Change-Id: I14773e38b5cc35679b16940ad230c7c81aeaad9c
diff --git a/tempest/api/compute/admin/test_hosts.py b/tempest/api/compute/admin/test_hosts.py
index 19d7973..bf09428 100644
--- a/tempest/api/compute/admin/test_hosts.py
+++ b/tempest/api/compute/admin/test_hosts.py
@@ -15,6 +15,7 @@
# under the License.
from tempest.api.compute import base
+from tempest.common import tempest_fixtures as fixtures
from tempest.common.utils.data_utils import rand_name
from tempest import exceptions
from tempest.test import attr
@@ -42,6 +43,7 @@
@attr(type='gate')
def test_list_hosts_with_zone(self):
+ self.useFixture(fixtures.LockFixture('availability_zone'))
resp, hosts = self.client.list_hosts()
host = hosts[0]
zone_name = host['zone']