shwstppr commented on code in PR #8096:
URL: https://github.com/apache/cloudstack/pull/8096#discussion_r1360659454
##########
test/integration/smoke/test_templates.py:
##########
@@ -1337,8 +1330,19 @@ def test_03_deploy_vm_wrong_checksum(self):
serviceofferingid=self.service_offering.id
)
self.cleanup.append(virtual_machine)
- self.fail("Expected to fail deployment")
+ failed = True
except Exception as e:
self.debug("Expected exception")
+ list_virtual_machine_response = VirtualMachine.list(
+ self.apiclient,
+ templateid=tmpl.id,
+ listall=True
+ )
+ if type(list_virtual_machine_response) == list and
len(list_virtual_machine_response) > 0:
+ for virtual_machine_response in list_virtual_machine_response:
+ VirtualMachine.delete(virtual_machine_response,
self.apiclient, expunge=True)
Review Comment:
If VM is deployed fine then we add `virtual_machine` to `self.cleanup`. Test
failed in this situation as VM shouldn't be deployed with wrong checksum of the
template.
If VM deployment failed then we delete VMs using template_id because though
the API returned error VM entry can still be there in the `Error` state. I
wanted to use
`self.cleanup.append(VirtualMachine(virtual_machine_response.__dict__)` but it
wasn't working for me.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]