Github user koushik-das commented on a diff in the pull request:
https://github.com/apache/cloudstack/pull/607#discussion_r35300288
--- Diff: test/integration/component/test_browse_templates.py ---
@@ -1674,6 +1674,42 @@ def
test_09_Browser_Upload_Volume_secondary_storage_resource_limits_after_deleti
return
+ @attr(tags = ["advanced", "advancedns", "smoke", "basic"],
required_hardware="false")
+ def test_browser_upload_template_incomplete(self):
+ """
+ Test browser based incomplete template upload, followed by SSVM
destroy. Template should go to UploadAbandoned state and get cleaned up.
+ """
+ try:
+ self.debug("========================= Test browser based
incomplete template upload ========================")
+
+ #Only register template, without uploading
+ cmd =
getUploadParamsForTemplate.getUploadParamsForTemplateCmd()
+ cmd.zoneid = self.zone.id
+ cmd.format = self.uploadtemplateformat
+
cmd.name=self.templatename+self.account.name+(random.choice(string.ascii_uppercase))
+ cmd.account=self.account.name
+ cmd.domainid=self.domain.id
+ cmd.displaytext=cmd.name
+ cmd.hypervisor=self.templatehypervisor
+ cmd.ostypeid=self.templateostypeid
+
template_response=self.apiclient.getUploadParamsForTemplate(cmd)
+
+ #Destroy SSVM, and wait for new one to start
+ self.destroy_ssvm()
+
+ #Verify that the template is cleaned up as part of sync-up
during new SSVM start
+ list_template_response=Template.list(
+ self.apiclient,
+ id=template_response.id,
+ templatefilter="all",
+ zoneid=self.zone.id)
+ self.assertEqual(list_template_response, None, "Template is
not cleaned up, some issue with template sync-up")
+
--- End diff --
It will not be possible to test for UploadAbandoned/Error as storage GC
thread will run and move the templates to Inactive state. It is difficult to
control at what point the storage GC thread runs and the assert needs happen
before that.
Thats why I am only asserting that the template is cleaned up at the end of
the test. The destroy_ssvm() ensures that storage GC runs at least once after
the template sync is done.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---