mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Summary: Fixes marvin integration test for copy template/iso between zones
Detail: This is a fix 1. to populate 'destzoneid' as part of the test data by issuing listZones API. Earlier, this is provided manually in the test data. 2. to wait till the ISO/template is downloaded & installed successfully before being deleted as part of the cleanup. BUG-ID: CLOUDSTACK-567 Reviewed-by: Prasanna Santhanam Reported-by: Prasanna Santhanam Signed-off-by: Prasanna Santhanam <tsp@apache.org> 1354234426 -0800
This commit is contained in:
parent
2c561dd3a8
commit
4b539ddcb3
@ -283,6 +283,13 @@ class TestTemplates(cloudstackTestCase):
|
||||
# Get Zone, templates etc
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
#populate second zone id for iso copy
|
||||
cmd = listZones.listZonesCmd()
|
||||
zones = cls.api_client.listZones(cmd)
|
||||
if not isinstance(zones, list):
|
||||
raise Exception("Failed to find zones.")
|
||||
if len(zones) >= 2:
|
||||
cls.services["destzoneid"] = zones[1].id
|
||||
|
||||
template = get_template(
|
||||
cls.api_client,
|
||||
@ -467,6 +474,36 @@ class TestTemplates(cloudstackTestCase):
|
||||
)
|
||||
|
||||
# Cleanup- Delete the copied template
|
||||
timeout = self.services["timeout"]
|
||||
while True:
|
||||
time.sleep(self.services["sleep"])
|
||||
list_template_response = list_templates(
|
||||
self.apiclient,
|
||||
templatefilter=\
|
||||
self.services["templatefilter"],
|
||||
id=self.template_2.id,
|
||||
zoneid=self.services["destzoneid"]
|
||||
)
|
||||
self.assertEqual(
|
||||
isinstance(list_template_response, list),
|
||||
True,
|
||||
"Check list response returns a valid list"
|
||||
)
|
||||
self.assertNotEqual(
|
||||
len(list_template_response),
|
||||
0,
|
||||
"Check template extracted in List Templates"
|
||||
)
|
||||
|
||||
template_response = list_template_response[0]
|
||||
if template_response.isready == True:
|
||||
break
|
||||
|
||||
if timeout == 0:
|
||||
raise Exception(
|
||||
"Failed to download copied template(ID: %s)" % template_response.id)
|
||||
|
||||
timeout = timeout - 1
|
||||
cmd = deleteTemplate.deleteTemplateCmd()
|
||||
cmd.id = self.template.id
|
||||
cmd.zoneid = self.services["destzoneid"]
|
||||
|
||||
@ -70,8 +70,6 @@ class Services:
|
||||
"mode": 'HTTP_DOWNLOAD',
|
||||
# Used in Extract template, value must be HTTP_DOWNLOAD
|
||||
},
|
||||
"destzoneid": 5,
|
||||
# Copy ISO from one zone to another (Destination Zone)
|
||||
"isfeatured": True,
|
||||
"ispublic": True,
|
||||
"isextractable": True,
|
||||
@ -203,6 +201,13 @@ class TestISO(cloudstackTestCase):
|
||||
cls.services["iso_1"]["zoneid"] = cls.zone.id
|
||||
cls.services["iso_2"]["zoneid"] = cls.zone.id
|
||||
cls.services["sourcezoneid"] = cls.zone.id
|
||||
#populate second zone id for iso copy
|
||||
cmd = listZones.listZonesCmd()
|
||||
zones = cls.api_client.listZones(cmd)
|
||||
if not isinstance(zones, list):
|
||||
raise Exception("Failed to find zones.")
|
||||
if len(zones) >= 2:
|
||||
cls.services["destzoneid"] = zones[1].id
|
||||
|
||||
#Create an account, ISOs etc.
|
||||
cls.account = Account.create(
|
||||
@ -524,6 +529,35 @@ class TestISO(cloudstackTestCase):
|
||||
|
||||
self.debug("Cleanup copied ISO: %s" % iso_response.id)
|
||||
# Cleanup- Delete the copied ISO
|
||||
timeout = self.services["timeout"]
|
||||
while True:
|
||||
time.sleep(self.services["sleep"])
|
||||
list_iso_response = list_isos(
|
||||
self.apiclient,
|
||||
id=self.iso_2.id,
|
||||
zoneid=self.services["destzoneid"]
|
||||
)
|
||||
self.assertEqual(
|
||||
isinstance(list_iso_response, list),
|
||||
True,
|
||||
"Check list response returns a valid list"
|
||||
)
|
||||
|
||||
self.assertNotEqual(
|
||||
len(list_iso_response),
|
||||
0,
|
||||
"Check template extracted in List ISO"
|
||||
)
|
||||
|
||||
iso_response = list_iso_response[0]
|
||||
if iso_response.isready == True:
|
||||
break
|
||||
|
||||
if timeout == 0:
|
||||
raise Exception(
|
||||
"Failed to download copied iso(ID: %s)" % iso_response.id)
|
||||
|
||||
timeout = timeout - 1
|
||||
cmd = deleteIso.deleteIsoCmd()
|
||||
cmd.id = iso_response.id
|
||||
cmd.zoneid = self.services["destzoneid"]
|
||||
|
||||
@ -87,8 +87,6 @@ class Services:
|
||||
"mode": "HTTP_DOWNLOAD",
|
||||
},
|
||||
"templatefilter": 'self',
|
||||
"destzoneid": 5,
|
||||
# For Copy template (Destination zone)
|
||||
"isfeatured": True,
|
||||
"ispublic": True,
|
||||
"isextractable": False,
|
||||
@ -295,6 +293,14 @@ class TestTemplates(cloudstackTestCase):
|
||||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
#populate second zone id for iso copy
|
||||
cmd = listZones.listZonesCmd()
|
||||
zones = cls.api_client.listZones(cmd)
|
||||
if not isinstance(zones, list):
|
||||
raise Exception("Failed to find zones.")
|
||||
if len(zones) >= 2:
|
||||
cls.services["destzoneid"] = zones[1].id
|
||||
|
||||
cls.disk_offering = DiskOffering.create(
|
||||
cls.api_client,
|
||||
cls.services["disk_offering"]
|
||||
@ -700,6 +706,36 @@ class TestTemplates(cloudstackTestCase):
|
||||
)
|
||||
|
||||
# Cleanup- Delete the copied template
|
||||
timeout = self.services["timeout"]
|
||||
while True:
|
||||
time.sleep(self.services["sleep"])
|
||||
list_template_response = list_templates(
|
||||
self.apiclient,
|
||||
templatefilter=\
|
||||
self.services["templatefilter"],
|
||||
id=self.template_2.id,
|
||||
zoneid=self.services["destzoneid"]
|
||||
)
|
||||
self.assertEqual(
|
||||
isinstance(list_template_response, list),
|
||||
True,
|
||||
"Check list response returns a valid list"
|
||||
)
|
||||
self.assertNotEqual(
|
||||
len(list_template_response),
|
||||
0,
|
||||
"Check template extracted in List Templates"
|
||||
)
|
||||
|
||||
template_response = list_template_response[0]
|
||||
if template_response.isready == True:
|
||||
break
|
||||
|
||||
if timeout == 0:
|
||||
raise Exception(
|
||||
"Failed to download copied template(ID: %s)" % template_response.id)
|
||||
|
||||
timeout = timeout - 1
|
||||
cmd = deleteTemplate.deleteTemplateCmd()
|
||||
cmd.id = template_response.id
|
||||
cmd.zoneid = self.services["destzoneid"]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user