Wait for metadata actually set to server
It is possible that at the time when deployment set its resource_id metadata will not actually be set at the server. Wait until metadata actually set at the server. This patch makes test more stable. Change-Id: Iba8c1c47b0cb78798a1c46a3daef5cb3cc3cc9a2
This commit is contained in:
parent
f67f4d9a9d
commit
5563024823
@ -83,7 +83,7 @@ properties:
|
|||||||
2,
|
2,
|
||||||
5,
|
5,
|
||||||
deploy_count)
|
deploy_count)
|
||||||
deploy_count = self.deploy_many_configs(
|
self.deploy_many_configs(
|
||||||
stack_identifier,
|
stack_identifier,
|
||||||
server,
|
server,
|
||||||
config_stacks,
|
config_stacks,
|
||||||
@ -95,24 +95,15 @@ properties:
|
|||||||
for config_stack in config_stacks:
|
for config_stack in config_stacks:
|
||||||
self._wait_for_stack_status(config_stack, 'CREATE_COMPLETE')
|
self._wait_for_stack_status(config_stack, 'CREATE_COMPLETE')
|
||||||
|
|
||||||
def deploy_many_configs(self, stack_identifier, server, config_stacks,
|
def deploy_many_configs(self, stack, server, config_stacks,
|
||||||
stack_count, deploys_per_stack,
|
stack_count, deploys_per_stack,
|
||||||
deploy_count_start):
|
deploy_count_start):
|
||||||
for a in range(stack_count):
|
for a in range(stack_count):
|
||||||
config_stacks.append(
|
config_stacks.append(
|
||||||
self.deploy_config(server, deploys_per_stack))
|
self.deploy_config(server, deploys_per_stack))
|
||||||
|
|
||||||
for config_stack in config_stacks:
|
|
||||||
self.wait_for_deploy_physical_id(config_stack)
|
|
||||||
|
|
||||||
new_count = deploy_count_start + stack_count * deploys_per_stack
|
new_count = deploy_count_start + stack_count * deploys_per_stack
|
||||||
server_metadata = self.client.resources.metadata(
|
self.wait_for_deploy_metadata_set(stack, new_count)
|
||||||
stack_identifier, 'server')
|
|
||||||
self.assertEqual(
|
|
||||||
new_count,
|
|
||||||
len(server_metadata['deployments']),
|
|
||||||
'%s stacks with %s deployments' % (stack_count, deploys_per_stack)
|
|
||||||
)
|
|
||||||
return new_count
|
return new_count
|
||||||
|
|
||||||
def deploy_config(self, server, deploy_count):
|
def deploy_config(self, server, deploy_count):
|
||||||
@ -128,19 +119,16 @@ properties:
|
|||||||
enable_cleanup=self.enable_cleanup,
|
enable_cleanup=self.enable_cleanup,
|
||||||
expected_status=None)
|
expected_status=None)
|
||||||
|
|
||||||
def wait_for_deploy_physical_id(self, stack):
|
def wait_for_deploy_metadata_set(self, stack, deploy_count):
|
||||||
build_timeout = self.conf.build_timeout
|
build_timeout = self.conf.build_timeout
|
||||||
build_interval = self.conf.build_interval
|
build_interval = self.conf.build_interval
|
||||||
|
|
||||||
start = timeutils.utcnow()
|
start = timeutils.utcnow()
|
||||||
while timeutils.delta_seconds(start,
|
while timeutils.delta_seconds(start,
|
||||||
timeutils.utcnow()) < build_timeout:
|
timeutils.utcnow()) < build_timeout:
|
||||||
created = True
|
server_metadata = self.client.resources.metadata(
|
||||||
for res in self.client.resources.list(stack, nested_depth='2'):
|
stack, 'server')
|
||||||
if not res.physical_resource_id:
|
if len(server_metadata['deployments']) == deploy_count:
|
||||||
created = False
|
|
||||||
break
|
|
||||||
if created:
|
|
||||||
return
|
return
|
||||||
time.sleep(build_interval)
|
time.sleep(build_interval)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user