Add locks for all aggregates tests with hosts
This commit adds locking to all the methods in test_aggregates that
add a host to an aggregate. Nova change
I788782a9f21ec2672551f75123753175bb268586 added a check so that
a host being added to an aggregate is not already a member of an
availability zone. This can cause an issue with running tempest in
parallel because tests in test_aggregates uses only one host for
multiple tests. If any of these tests are run at the same time as a
test where the host is added to an availability zone it will fail.
By adding locking to all the tests with adding hosts to an aggregate
this ensures that this failure will not occur.
part of blueprint speed-up-tempest
Change-Id: Iaf8a903d92c88c7c3092eaa00a9f7a96e6348ddc
diff --git a/tempest/api/compute/admin/test_aggregates.py b/tempest/api/compute/admin/test_aggregates.py
index 107d635..303bc0c 100644
--- a/tempest/api/compute/admin/test_aggregates.py
+++ b/tempest/api/compute/admin/test_aggregates.py
@@ -146,6 +146,7 @@
self.client.get_aggregate, -1)
@attr(type='gate')
+ @lockutils.synchronized('availability_zone', 'tempest-', True)
def test_aggregate_add_remove_host(self):
# Add an host to the given aggregate and remove.
aggregate_name = rand_name(self.aggregate_name_prefix)
@@ -167,6 +168,7 @@
self.assertNotIn(self.host, body['hosts'])
@attr(type='gate')
+ @lockutils.synchronized('availability_zone', 'tempest-', True)
def test_aggregate_add_host_list(self):
# Add an host to the given aggregate and list.
aggregate_name = rand_name(self.aggregate_name_prefix)
@@ -184,6 +186,7 @@
self.assertIn(self.host, agg['hosts'])
@attr(type='gate')
+ @lockutils.synchronized('availability_zone', 'tempest-', True)
def test_aggregate_add_host_get_details(self):
# Add an host to the given aggregate and get details.
aggregate_name = rand_name(self.aggregate_name_prefix)
@@ -245,6 +248,7 @@
aggregate['id'], self.host)
@attr(type=['negative', 'gate'])
+ @lockutils.synchronized('availability_zone', 'tempest-', True)
def test_aggregate_remove_host_as_user(self):
# Regular user is not allowed to remove a host from an aggregate.
aggregate_name = rand_name(self.aggregate_name_prefix)