[fix gate] Cluster grow not showing locality

The scenario tests for clusters are occasionally failing when doing a
cluster-show after a cluster-grow. This seems to happen because the
locality flag on the new instances takes a few seconds (sometimes) to
populate. This results in a 'AssertionError: Cluster missing attribute
locality.' error in the cluster grow test.

The fix is to check all the instances for the server_group information
instead of just the first instance.

The cluster tests were also tweaked so they could be run separately.

Change-Id: I4f369231a8f0bc8cad338e2eb1de9cd1ca0253f6
Closes-Bug: #1621634
This commit is contained in:
Peter Stachowski 2016-09-08 21:17:38 +00:00
parent 7c46c3734d
commit 3ae00fcf69
2 changed files with 10 additions and 3 deletions

View File

@ -206,7 +206,13 @@ class Cluster(object):
def server_group(self):
# The server group could be empty, so we need a flag to cache it
if not self._server_group_loaded and self.instances:
self._server_group = self.instances[0].server_group
self._server_group = None
# Not all the instances may have the server group loaded, so
# check them all
for instance in self.instances:
if instance.server_group:
self._server_group = instance.server_group
break
self._server_group_loaded = True
return self._server_group

View File

@ -212,10 +212,11 @@ class ClusterActionsRunner(TestRunner):
def run_cluster_grow(self, expected_task_name='GROWING_CLUSTER',
expected_http_code=202):
# Add two instances. One with an explicit name.
flavor_href = self.get_flavor_href(self.get_instance_flavor())
added_instance_defs = [
self._build_instance_def(self.instance_info.dbaas_flavor_href,
self._build_instance_def(flavor_href,
self.instance_info.volume['size']),
self._build_instance_def(self.instance_info.dbaas_flavor_href,
self._build_instance_def(flavor_href,
self.instance_info.volume['size'],
self.EXTRA_INSTANCE_NAME)]
self.assert_cluster_grow(