CLOUDSTACK-5674: Some fixes to marvin and resultant changes to tests.

This commit is contained in:
Girish Shilamkar 2014-01-28 02:11:24 -05:00
parent 6c5b1670b2
commit 226df296d0
5 changed files with 18 additions and 21 deletions

View File

@ -38,7 +38,7 @@ class TestHosts(cloudstackTestCase):
self.dbclient = self.testClient.getDbConnection() self.dbclient = self.testClient.getDbConnection()
self.services = self.testClient.getParsedTestDataConfig() self.services = self.testClient.getParsedTestDataConfig()
self.zone = get_zone(self.apiclient, self.getZoneForTests()) 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 = [] self.cleanup = []
return return

View File

@ -47,7 +47,7 @@ class TestDeployVM(cloudstackTestCase):
self.apiclient = self.testClient.getApiClient() self.apiclient = self.testClient.getApiClient()
# Get Zone, Domain and Default Built-in template # 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.zone = get_zone(self.apiclient, self.getZoneForTests())
self.testdata["mode"] = self.zone.networktype self.testdata["mode"] = self.zone.networktype
self.template = get_template(self.apiclient, self.zone.id, self.testdata["ostype"]) self.template = get_template(self.apiclient, self.zone.id, self.testdata["ostype"])

View File

@ -18,7 +18,7 @@
""" """
#Import Local Modules #Import Local Modules
import marvin import marvin
from marvin.cloudstackException import cloudstackAPIException from marvin.cloudstackException import CloudstackAPIException
from marvin.cloudstackTestCase import * from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import * from marvin.cloudstackAPI import *
from marvin.sshClient import SshClient from marvin.sshClient import SshClient
@ -383,7 +383,7 @@ class TestPortForwarding(cloudstackTestCase):
self.apiclient, self.apiclient,
id=nat_rule.id id=nat_rule.id
) )
except cloudstackAPIException: except CloudstackAPIException:
self.debug("Nat Rule is deleted") self.debug("Nat Rule is deleted")
# Check if the Public SSH port is inaccessible # Check if the Public SSH port is inaccessible
@ -501,7 +501,7 @@ class TestPortForwarding(cloudstackTestCase):
self.apiclient, self.apiclient,
id=nat_rule.id id=nat_rule.id
) )
except cloudstackAPIException: except CloudstackAPIException:
self.debug("Nat Rule is deleted") self.debug("Nat Rule is deleted")
# Check if the Public SSH port is inaccessible # Check if the Public SSH port is inaccessible
@ -801,7 +801,7 @@ class TestReleaseIP(cloudstackTestCase):
id=self.nat_rule.id id=self.nat_rule.id
) )
self.debug("List NAT Rule response" + str(list_nat_rule)) self.debug("List NAT Rule response" + str(list_nat_rule))
except cloudstackAPIException: except CloudstackAPIException:
self.debug("Port Forwarding Rule is deleted") self.debug("Port Forwarding Rule is deleted")
# listLoadBalancerRules should not list # listLoadBalancerRules should not list
@ -812,7 +812,7 @@ class TestReleaseIP(cloudstackTestCase):
id=self.lb_rule.id id=self.lb_rule.id
) )
self.debug("List LB Rule response" + str(list_lb_rule)) self.debug("List LB Rule response" + str(list_lb_rule))
except cloudstackAPIException: except CloudstackAPIException:
self.debug("Port Forwarding Rule is deleted") self.debug("Port Forwarding Rule is deleted")
# SSH Attempt though public IP should fail # SSH Attempt though public IP should fail
@ -927,7 +927,7 @@ class TestDeleteAccount(cloudstackTestCase):
account=self.account.name, account=self.account.name,
domainid=self.account.domainid domainid=self.account.domainid
) )
except cloudstackAPIException: except CloudstackAPIException:
self.debug("Port Forwarding Rule is deleted") self.debug("Port Forwarding Rule is deleted")
# ListPortForwardingRules should not # ListPortForwardingRules should not
@ -938,7 +938,7 @@ class TestDeleteAccount(cloudstackTestCase):
account=self.account.name, account=self.account.name,
domainid=self.account.domainid domainid=self.account.domainid
) )
except cloudstackAPIException: except CloudstackAPIException:
self.debug("NATRule is deleted") self.debug("NATRule is deleted")
#Retrieve router for the user account #Retrieve router for the user account
@ -953,7 +953,7 @@ class TestDeleteAccount(cloudstackTestCase):
None, None,
"Check routers are properly deleted." "Check routers are properly deleted."
) )
except cloudstackAPIException: except CloudstackAPIException:
self.debug("Router is deleted") self.debug("Router is deleted")
except Exception as e: except Exception as e:

View File

@ -679,7 +679,7 @@ class TestVMLifeCycle(cloudstackTestCase):
try: try:
#Unmount ISO #Unmount ISO
command = "umount %s" % "mount_dir command = "umount %s" % mount_dir
ssh_client.execute(command) ssh_client.execute(command)
except Exception as e: except Exception as e:
self.fail("SSH failed for virtual machine: %s - %s" % self.fail("SSH failed for virtual machine: %s - %s" %

View File

@ -161,8 +161,7 @@ def get_region(apiclient, region_id=None, region_name=None):
if region_id is not None: if region_id is not None:
cmd.id = region_id cmd.id = region_id
cmd_out = apiclient.listRegions(cmd) cmd_out = apiclient.listRegions(cmd)
return FAILED if validateList(cmd_out)[0] != PASS return FAILED if validateList(cmd_out)[0] != PASS else cmd_out
return cmd_out
def get_domain(apiclient, domain_id=None, domain_name=None): 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: if domain_id is not None:
cmd.id = domain_id cmd.id = domain_id
cmd_out = apiclient.listRegions(cmd) cmd_out = apiclient.listRegions(cmd)
return FAILED if validateList(cmd_out)[0] != PASS return FAILED if validateList(cmd_out)[0] != PASS else cmd_out
return cmd_out
def get_zone(apiclient, zone_name=None, zone_id=None): 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) 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, Check if input zone name and zone id is None,
then return first element of List Zones command 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] return cmd_out[0]
else: else:
return cmd_out 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) cmd_out = apiclient.listPods(cmd)
return FAILED if ( validateList(cmd_out)[0] != PASS ) return FAILED if (validateList(cmd_out)[0] != PASS) else cmd_out
return cmd_out
def get_template(apiclient, zone_id=None, ostype_desc=None, template_filter="featured", template_type='BUILTIN', 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 cmd.description = ostype_desc
ostypes_out = apiclient.listOsTypes(cmd) 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 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 Get the Templates pertaining
''' '''
list_templatesout = apiclient.listTemplates(cmd) 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: for template in list_templatesout:
if template.ostypeid == ostype_id and template.isready and template.templatetype == template_type: if template.ostypeid == ostype_id and template.isready and template.templatetype == template_type: