Fix Heat OSTF test
Fix incorrect stack resources processing in the tests. Change-Id: Iaf0ab8a7c4f14c462232d1f9e0de0195da6ca3bf Closes-Bug: #1452576
This commit is contained in:
parent
740ded337b
commit
1b20a06c8d
|
@ -18,3 +18,7 @@ resources:
|
||||||
flavor_update_policy: REPLACE
|
flavor_update_policy: REPLACE
|
||||||
networks:
|
networks:
|
||||||
- network: {Ref: network}
|
- network: {Ref: network}
|
||||||
|
outputs:
|
||||||
|
servers:
|
||||||
|
value:
|
||||||
|
get_resource: Server
|
||||||
|
|
|
@ -14,3 +14,7 @@ resources:
|
||||||
image: {get_param: ImageId}
|
image: {get_param: ImageId}
|
||||||
flavor: {get_param: InstanceType}
|
flavor: {get_param: InstanceType}
|
||||||
flavor_update_policy: REPLACE
|
flavor_update_policy: REPLACE
|
||||||
|
outputs:
|
||||||
|
servers:
|
||||||
|
value:
|
||||||
|
get_resource: Server
|
||||||
|
|
|
@ -24,3 +24,10 @@ resources:
|
||||||
flavor: {get_param: InstanceType}
|
flavor: {get_param: InstanceType}
|
||||||
networks:
|
networks:
|
||||||
- network: {Ref: network}
|
- network: {Ref: network}
|
||||||
|
outputs:
|
||||||
|
server1:
|
||||||
|
value:
|
||||||
|
get_resource: Server1
|
||||||
|
server2:
|
||||||
|
value:
|
||||||
|
get_resource: Server2
|
||||||
|
|
|
@ -17,3 +17,10 @@ resources:
|
||||||
properties:
|
properties:
|
||||||
image: {get_param: ImageId}
|
image: {get_param: ImageId}
|
||||||
flavor: {get_param: InstanceType}
|
flavor: {get_param: InstanceType}
|
||||||
|
outputs:
|
||||||
|
server1:
|
||||||
|
value:
|
||||||
|
get_resource: Server1
|
||||||
|
server2:
|
||||||
|
value:
|
||||||
|
get_resource: Server2
|
||||||
|
|
|
@ -196,7 +196,16 @@ class HeatBaseTest(fuel_health.nmanager.NovaNetworkScenarioTest):
|
||||||
return '\n'.join(line for line in template.splitlines()
|
return '\n'.join(line for line in template.splitlines()
|
||||||
if 'Ref: Subnet' not in line)
|
if 'Ref: Subnet' not in line)
|
||||||
|
|
||||||
def _get_stack_instances(self, mask_name):
|
def _get_stack_instances(self, stack_id):
|
||||||
|
|
||||||
|
servers = self.heat_client.stacks.get(stack_id).outputs
|
||||||
|
server_ids = [server['output_value'] for server in servers]
|
||||||
|
|
||||||
|
LOG.info('SERVERS {0}'.format(server_ids))
|
||||||
|
|
||||||
|
return server_ids
|
||||||
|
|
||||||
|
def _get_instances_by_name_mask(self, mask_name):
|
||||||
self.instances = []
|
self.instances = []
|
||||||
|
|
||||||
# find just created instance
|
# find just created instance
|
||||||
|
|
|
@ -74,7 +74,7 @@ class HeatSmokeTests(heatmanager.HeatBaseTest):
|
||||||
"stack status becoming 'CREATE_COMPLETE'",
|
"stack status becoming 'CREATE_COMPLETE'",
|
||||||
stack.id, 'CREATE_COMPLETE')
|
stack.id, 'CREATE_COMPLETE')
|
||||||
|
|
||||||
instances = self._get_stack_instances("ost1-test_heat")
|
instances = self._get_stack_instances(stack.id)
|
||||||
|
|
||||||
if not instances:
|
if not instances:
|
||||||
self.fail("Failed step: 2 Instance for the {0} stack "
|
self.fail("Failed step: 2 Instance for the {0} stack "
|
||||||
|
@ -92,7 +92,7 @@ class HeatSmokeTests(heatmanager.HeatBaseTest):
|
||||||
stack.id, 'SUSPEND_COMPLETE')
|
stack.id, 'SUSPEND_COMPLETE')
|
||||||
|
|
||||||
fail_msg = "Server is not in SUSPENDED status."
|
fail_msg = "Server is not in SUSPENDED status."
|
||||||
inst_status = self.compute_client.servers.get(instances[0].id).status
|
inst_status = self.compute_client.servers.get(instances[0]).status
|
||||||
self.verify_response_body_content(inst_status, 'SUSPENDED',
|
self.verify_response_body_content(inst_status, 'SUSPENDED',
|
||||||
fail_msg, 4)
|
fail_msg, 4)
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ class HeatSmokeTests(heatmanager.HeatBaseTest):
|
||||||
stack.id, 'RESUME_COMPLETE')
|
stack.id, 'RESUME_COMPLETE')
|
||||||
|
|
||||||
fail_msg = "Server is not in ACTIVE status."
|
fail_msg = "Server is not in ACTIVE status."
|
||||||
inst_status = self.compute_client.servers.get(instances[0].id).status
|
inst_status = self.compute_client.servers.get(instances[0]).status
|
||||||
self.verify_response_body_content(inst_status, 'ACTIVE',
|
self.verify_response_body_content(inst_status, 'ACTIVE',
|
||||||
fail_msg, 6)
|
fail_msg, 6)
|
||||||
|
|
||||||
|
@ -314,7 +314,7 @@ class HeatSmokeTests(heatmanager.HeatBaseTest):
|
||||||
"stack status becoming 'CREATE_COMPLETE'",
|
"stack status becoming 'CREATE_COMPLETE'",
|
||||||
stack.id, 'CREATE_COMPLETE')
|
stack.id, 'CREATE_COMPLETE')
|
||||||
|
|
||||||
instances = self._get_stack_instances("ost1-test_heat")
|
instances = self._get_stack_instances(stack.id)
|
||||||
|
|
||||||
if not instances:
|
if not instances:
|
||||||
self.fail("Failed step: 2 Instance for the {0} stack "
|
self.fail("Failed step: 2 Instance for the {0} stack "
|
||||||
|
@ -338,7 +338,7 @@ class HeatSmokeTests(heatmanager.HeatBaseTest):
|
||||||
stack.id, 'UPDATE_COMPLETE')
|
stack.id, 'UPDATE_COMPLETE')
|
||||||
|
|
||||||
new_instance_name = self.compute_client.servers.get(
|
new_instance_name = self.compute_client.servers.get(
|
||||||
instances[0].id).name
|
instances[0]).name
|
||||||
|
|
||||||
if new_instance_name != "ost1-test_updated":
|
if new_instance_name != "ost1-test_updated":
|
||||||
self.fail("Failed step: 5 Stack update inplace wasn't "
|
self.fail("Failed step: 5 Stack update inplace wasn't "
|
||||||
|
@ -364,9 +364,12 @@ class HeatSmokeTests(heatmanager.HeatBaseTest):
|
||||||
"stack status becoming 'UPDATE_COMPLETE'",
|
"stack status becoming 'UPDATE_COMPLETE'",
|
||||||
stack.id, 'UPDATE_COMPLETE')
|
stack.id, 'UPDATE_COMPLETE')
|
||||||
|
|
||||||
instances = self._get_stack_instances("ost1-test_updated")
|
instances = self._get_stack_instances(stack.id)
|
||||||
|
old_instance_id = instances[0]
|
||||||
|
|
||||||
|
new_instance_flavor = self.compute_client.servers.get(
|
||||||
|
instances[0]).flavor['id']
|
||||||
|
|
||||||
new_instance_flavor = instances[0].flavor['id']
|
|
||||||
if new_instance_flavor != flavor.id:
|
if new_instance_flavor != flavor.id:
|
||||||
self.fail("Failed step: 9 Stack update replace wasn't "
|
self.fail("Failed step: 9 Stack update replace wasn't "
|
||||||
"finished, instance flavor wasn't changed.")
|
"finished, instance flavor wasn't changed.")
|
||||||
|
@ -397,15 +400,13 @@ class HeatSmokeTests(heatmanager.HeatBaseTest):
|
||||||
"stack status becoming 'UPDATE_COMPLETE'",
|
"stack status becoming 'UPDATE_COMPLETE'",
|
||||||
stack.id, 'UPDATE_COMPLETE')
|
stack.id, 'UPDATE_COMPLETE')
|
||||||
|
|
||||||
instances = self._get_stack_instances(stack.stack_name)
|
instances = self._get_stack_instances(stack.id)
|
||||||
|
|
||||||
if len(instances) != 2:
|
if len(instances) != 2:
|
||||||
self.fail("Failed step: 12 There are more then two expected "
|
self.fail("Failed step: 12 There are more then two expected "
|
||||||
"instances belonging test stack.")
|
"instances belonging test stack.")
|
||||||
|
|
||||||
instances = self._get_stack_instances("ost1-test_updated")
|
if old_instance_id in instances:
|
||||||
|
|
||||||
if instances:
|
|
||||||
self.fail("Failed step: 12 Previously create instance "
|
self.fail("Failed step: 12 Previously create instance "
|
||||||
"wasn't deleted during stack update.")
|
"wasn't deleted during stack update.")
|
||||||
|
|
||||||
|
@ -492,7 +493,7 @@ class HeatSmokeTests(heatmanager.HeatBaseTest):
|
||||||
reduced_stack_name = '{0}-{1}'.format(
|
reduced_stack_name = '{0}-{1}'.format(
|
||||||
stack.stack_name[:2], stack.stack_name[-4:])
|
stack.stack_name[:2], stack.stack_name[-4:])
|
||||||
|
|
||||||
instances = self._get_stack_instances(reduced_stack_name)
|
instances = self._get_instances_by_name_mask(reduced_stack_name)
|
||||||
|
|
||||||
if not instances:
|
if not instances:
|
||||||
self.fail("Failed step: 5 Instance for the {0} stack "
|
self.fail("Failed step: 5 Instance for the {0} stack "
|
||||||
|
@ -595,8 +596,8 @@ class HeatSmokeTests(heatmanager.HeatBaseTest):
|
||||||
"rolling back the stack after its creation failed",
|
"rolling back the stack after its creation failed",
|
||||||
stack.id)
|
stack.id)
|
||||||
|
|
||||||
instances = [i for i in self.compute_client.servers.list()
|
instances = self._get_instances_by_name_mask(stack.stack_name)
|
||||||
if i.name.startswith(stack.stack_name)]
|
|
||||||
self.verify(20, self.assertTrue, 4,
|
self.verify(20, self.assertTrue, 4,
|
||||||
"The stack instance rollback failed.",
|
"The stack instance rollback failed.",
|
||||||
"verifying if the instance was rolled back",
|
"verifying if the instance was rolled back",
|
||||||
|
|
Loading…
Reference in New Issue