Fixed few issues for CLOUDSTACK-6316,CLOUDSTACK-5674

Fixed issues related to the mentioned bugs.
More information in the bug.

Signed-off-by: Santhosh Edukulla <Santhosh.Edukulla@citrix.com>
Signed-off-by: SrikanteswaraRao Talluri <talluri@apache.org>
This commit is contained in:
Santhosh Edukulla 2014-04-02 04:57:39 +05:30 committed by SrikanteswaraRao Talluri
parent 63d3688360
commit 34409d74cd
7 changed files with 14 additions and 20 deletions

View File

@ -67,6 +67,9 @@ class TestDeployVmWithUserData(cloudstackTestCase):
user_data = ''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(2500))
cls.services["virtual_machine"]["userdata"] = user_data
def setup(self):
self.hypervisor = self.testClient.getHypervisorInfo()
@attr(tags=["simulator", "devcloud", "basic", "advanced", "post"])
def test_deployvm_userdata_post(self):
"""Test userdata as POST, size > 2k

View File

@ -143,7 +143,7 @@ class TestISO(cloudstackTestCase):
cls.services = testClient.getParsedTestDataConfig()
# Get Zone, Domain and templates
cls.domain = get_domain(cls.apiclient, cls.testClient.getZoneForTests())
cls.domain = get_domain(cls.apiclient)
cls.zone = get_zone(cls.apiclient, cls.testClient.getZoneForTests())
cls.services["domainid"] = cls.domain.id

View File

@ -31,7 +31,7 @@ class TestDedicatePublicIPRange(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.testClient = super(TestDedicatePublicIPRange, cls).getClsTestClient()
cls.apivlient = cls.testClient.getApiClient()
cls.apiclient = cls.testClient.getApiClient()
cls.services = cls.testClient.getParsedTestDataConfig()
# Get Zone, Domain
cls.domain = get_domain(cls.apiclient)

View File

@ -231,7 +231,7 @@ class TestTemplates(cloudstackTestCase):
cls.services = testClient.getParsedTestDataConfig()
# Get Zone, Domain and templates
cls.domain = get_domain(cls.apiclient, cls.getZoneForTests())
cls.domain = get_domain(cls.apiclient)
cls.zone = get_zone(cls.apiclient, cls.testClient.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
#populate second zone id for iso copy

View File

@ -16,7 +16,6 @@
# under the License.
# Import Local Modules
import marvin
from marvin.codes import FAILED
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import *

View File

@ -334,7 +334,7 @@ class VirtualMachine:
cmd.zoneid = zoneid
elif "zoneid" in services:
cmd.zoneid = services["zoneid"]
cmd.hypervisor = apiclient.hypervisor
cmd.hypervisor = hypervisor
if "displayname" in services:
cmd.displayname = services["displayname"]

View File

@ -189,11 +189,7 @@ def get_domain(apiclient, domain_id=None, domain_name=None):
cmd_out = apiclient.listDomains(cmd)
if validateList(cmd_out)[0] != PASS:
return FAILED
if (domain_id is None and domain_name is None):
return cmd_out[0]
else:
return cmd_out
return cmd_out[0]
def get_zone(apiclient, zone_name=None, zone_id=None):
@ -219,10 +215,7 @@ def get_zone(apiclient, zone_name=None, zone_id=None):
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):
return cmd_out[0]
else:
return cmd_out
return cmd_out[0]
def get_pod(apiclient, zone_id=None, pod_id=None, pod_name=None):
@ -248,11 +241,7 @@ def get_pod(apiclient, zone_id=None, pod_id=None, pod_name=None):
if validateList(cmd_out)[0] != PASS:
return FAILED
if (pod_id is None and pod_name is None):
return cmd_out[0]
else:
return cmd_out
return cmd_out[0]
def get_template(
@ -286,7 +275,7 @@ def get_template(
cmd.account = account
'''
Get the Templates pertaining
Get the Templates pertaining to the inputs provided
'''
list_templatesout = apiclient.listTemplates(cmd)
if validateList(list_templatesout)[0] != PASS:
@ -295,6 +284,9 @@ def get_template(
for template in list_templatesout:
if template.isready and template.templatetype == template_type:
return template
'''
Return default first template, if no template matched
'''
return list_templatesout[0]