mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-5674: Some fixes to marvin and resultant changes to tests.
This commit is contained in:
parent
6c5b1670b2
commit
226df296d0
@ -38,7 +38,7 @@ class TestHosts(cloudstackTestCase):
|
||||
self.dbclient = self.testClient.getDbConnection()
|
||||
self.services = self.testClient.getParsedTestDataConfig()
|
||||
self.zone = get_zone(self.apiclient, self.getZoneForTests())
|
||||
self.pod = get_pod(apilcient=self.apiclient, self.zone.id)
|
||||
self.pod = get_pod(self.apiclient, self.zone.id)
|
||||
self.cleanup = []
|
||||
|
||||
return
|
||||
|
||||
@ -47,7 +47,7 @@ class TestDeployVM(cloudstackTestCase):
|
||||
self.apiclient = self.testClient.getApiClient()
|
||||
|
||||
# Get Zone, Domain and Default Built-in template
|
||||
self.domain = get_domain(self.apiclient))
|
||||
self.domain = get_domain(self.apiclient)
|
||||
self.zone = get_zone(self.apiclient, self.getZoneForTests())
|
||||
self.testdata["mode"] = self.zone.networktype
|
||||
self.template = get_template(self.apiclient, self.zone.id, self.testdata["ostype"])
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
"""
|
||||
#Import Local Modules
|
||||
import marvin
|
||||
from marvin.cloudstackException import cloudstackAPIException
|
||||
from marvin.cloudstackException import CloudstackAPIException
|
||||
from marvin.cloudstackTestCase import *
|
||||
from marvin.cloudstackAPI import *
|
||||
from marvin.sshClient import SshClient
|
||||
@ -383,7 +383,7 @@ class TestPortForwarding(cloudstackTestCase):
|
||||
self.apiclient,
|
||||
id=nat_rule.id
|
||||
)
|
||||
except cloudstackAPIException:
|
||||
except CloudstackAPIException:
|
||||
self.debug("Nat Rule is deleted")
|
||||
|
||||
# Check if the Public SSH port is inaccessible
|
||||
@ -501,7 +501,7 @@ class TestPortForwarding(cloudstackTestCase):
|
||||
self.apiclient,
|
||||
id=nat_rule.id
|
||||
)
|
||||
except cloudstackAPIException:
|
||||
except CloudstackAPIException:
|
||||
self.debug("Nat Rule is deleted")
|
||||
|
||||
# Check if the Public SSH port is inaccessible
|
||||
@ -801,7 +801,7 @@ class TestReleaseIP(cloudstackTestCase):
|
||||
id=self.nat_rule.id
|
||||
)
|
||||
self.debug("List NAT Rule response" + str(list_nat_rule))
|
||||
except cloudstackAPIException:
|
||||
except CloudstackAPIException:
|
||||
self.debug("Port Forwarding Rule is deleted")
|
||||
|
||||
# listLoadBalancerRules should not list
|
||||
@ -812,7 +812,7 @@ class TestReleaseIP(cloudstackTestCase):
|
||||
id=self.lb_rule.id
|
||||
)
|
||||
self.debug("List LB Rule response" + str(list_lb_rule))
|
||||
except cloudstackAPIException:
|
||||
except CloudstackAPIException:
|
||||
self.debug("Port Forwarding Rule is deleted")
|
||||
|
||||
# SSH Attempt though public IP should fail
|
||||
@ -927,7 +927,7 @@ class TestDeleteAccount(cloudstackTestCase):
|
||||
account=self.account.name,
|
||||
domainid=self.account.domainid
|
||||
)
|
||||
except cloudstackAPIException:
|
||||
except CloudstackAPIException:
|
||||
self.debug("Port Forwarding Rule is deleted")
|
||||
|
||||
# ListPortForwardingRules should not
|
||||
@ -938,7 +938,7 @@ class TestDeleteAccount(cloudstackTestCase):
|
||||
account=self.account.name,
|
||||
domainid=self.account.domainid
|
||||
)
|
||||
except cloudstackAPIException:
|
||||
except CloudstackAPIException:
|
||||
self.debug("NATRule is deleted")
|
||||
|
||||
#Retrieve router for the user account
|
||||
@ -953,7 +953,7 @@ class TestDeleteAccount(cloudstackTestCase):
|
||||
None,
|
||||
"Check routers are properly deleted."
|
||||
)
|
||||
except cloudstackAPIException:
|
||||
except CloudstackAPIException:
|
||||
self.debug("Router is deleted")
|
||||
|
||||
except Exception as e:
|
||||
|
||||
@ -679,7 +679,7 @@ class TestVMLifeCycle(cloudstackTestCase):
|
||||
|
||||
try:
|
||||
#Unmount ISO
|
||||
command = "umount %s" % "mount_dir
|
||||
command = "umount %s" % mount_dir
|
||||
ssh_client.execute(command)
|
||||
except Exception as e:
|
||||
self.fail("SSH failed for virtual machine: %s - %s" %
|
||||
|
||||
@ -161,8 +161,7 @@ def get_region(apiclient, region_id=None, region_name=None):
|
||||
if region_id is not None:
|
||||
cmd.id = region_id
|
||||
cmd_out = apiclient.listRegions(cmd)
|
||||
return FAILED if validateList(cmd_out)[0] != PASS
|
||||
return cmd_out
|
||||
return FAILED if validateList(cmd_out)[0] != PASS else cmd_out
|
||||
|
||||
|
||||
def get_domain(apiclient, domain_id=None, domain_name=None):
|
||||
@ -181,8 +180,7 @@ def get_domain(apiclient, domain_id=None, domain_name=None):
|
||||
if domain_id is not None:
|
||||
cmd.id = domain_id
|
||||
cmd_out = apiclient.listRegions(cmd)
|
||||
return FAILED if validateList(cmd_out)[0] != PASS
|
||||
return cmd_out
|
||||
return FAILED if validateList(cmd_out)[0] != PASS else cmd_out
|
||||
|
||||
|
||||
def get_zone(apiclient, zone_name=None, zone_id=None):
|
||||
@ -202,12 +200,12 @@ def get_zone(apiclient, zone_name=None, zone_id=None):
|
||||
|
||||
cmd_out = apiclient.listZones(cmd)
|
||||
|
||||
return FAILED if (validateList(cmd_out)[0] != PASS)
|
||||
if validateList(cmd_out)[0] != PASS: return FAILED
|
||||
'''
|
||||
Check if input zone name and zone id is None,
|
||||
then return first element of List Zones command
|
||||
'''
|
||||
if ( zone_name is None and zone_id is None )
|
||||
if (zone_name is None and zone_id is None):
|
||||
return cmd_out[0]
|
||||
else:
|
||||
return cmd_out
|
||||
@ -235,8 +233,7 @@ def get_pod(apiclient, zone_id=None, pod_id=None, pod_name=None):
|
||||
|
||||
cmd_out = apiclient.listPods(cmd)
|
||||
|
||||
return FAILED if ( validateList(cmd_out)[0] != PASS )
|
||||
return cmd_out
|
||||
return FAILED if (validateList(cmd_out)[0] != PASS) else cmd_out
|
||||
|
||||
|
||||
def get_template(apiclient, zone_id=None, ostype_desc=None, template_filter="featured", template_type='BUILTIN',
|
||||
@ -259,7 +256,7 @@ def get_template(apiclient, zone_id=None, ostype_desc=None, template_filter="fea
|
||||
cmd.description = ostype_desc
|
||||
ostypes_out = apiclient.listOsTypes(cmd)
|
||||
|
||||
return FAILED if (validateList(ostypes_out)[0] != PASS )
|
||||
if (validateList(ostypes_out)[0] != PASS): return FAILED
|
||||
|
||||
ostype_id = ostypes_out[0].id
|
||||
|
||||
@ -284,7 +281,7 @@ def get_template(apiclient, zone_id=None, ostype_desc=None, template_filter="fea
|
||||
Get the Templates pertaining
|
||||
'''
|
||||
list_templatesout = apiclient.listTemplates(cmd)
|
||||
return FAILED if validateList(list_templatesout)[0] != PASS
|
||||
if validateList(list_templatesout)[0] != PASS: return FAILED
|
||||
|
||||
for template in list_templatesout:
|
||||
if template.ostypeid == ostype_id and template.isready and template.templatetype == template_type:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user