From 34409d74cd62c3c8f26ca42fe02237892fc93bbd Mon Sep 17 00:00:00 2001 From: Santhosh Edukulla Date: Wed, 2 Apr 2014 04:57:39 +0530 Subject: [PATCH] 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 Signed-off-by: SrikanteswaraRao Talluri --- .../smoke/test_deploy_vm_with_userdata.py | 3 +++ test/integration/smoke/test_iso.py | 2 +- .../integration/smoke/test_public_ip_range.py | 2 +- test/integration/smoke/test_templates.py | 2 +- test/integration/smoke/test_vm_snapshots.py | 1 - tools/marvin/marvin/lib/base.py | 2 +- tools/marvin/marvin/lib/common.py | 22 ++++++------------- 7 files changed, 14 insertions(+), 20 deletions(-) diff --git a/test/integration/smoke/test_deploy_vm_with_userdata.py b/test/integration/smoke/test_deploy_vm_with_userdata.py index c1410fbb6e0..aec633418d2 100644 --- a/test/integration/smoke/test_deploy_vm_with_userdata.py +++ b/test/integration/smoke/test_deploy_vm_with_userdata.py @@ -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 diff --git a/test/integration/smoke/test_iso.py b/test/integration/smoke/test_iso.py index b3c318101b2..37990b7c6b5 100644 --- a/test/integration/smoke/test_iso.py +++ b/test/integration/smoke/test_iso.py @@ -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 diff --git a/test/integration/smoke/test_public_ip_range.py b/test/integration/smoke/test_public_ip_range.py index 50b0c9b9c68..ca3c83bd873 100644 --- a/test/integration/smoke/test_public_ip_range.py +++ b/test/integration/smoke/test_public_ip_range.py @@ -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) diff --git a/test/integration/smoke/test_templates.py b/test/integration/smoke/test_templates.py index b25359b22a5..54b0a83b9a6 100644 --- a/test/integration/smoke/test_templates.py +++ b/test/integration/smoke/test_templates.py @@ -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 diff --git a/test/integration/smoke/test_vm_snapshots.py b/test/integration/smoke/test_vm_snapshots.py index 4317d4dcbe7..ca6af319434 100644 --- a/test/integration/smoke/test_vm_snapshots.py +++ b/test/integration/smoke/test_vm_snapshots.py @@ -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 * diff --git a/tools/marvin/marvin/lib/base.py b/tools/marvin/marvin/lib/base.py index a2f9a8bb95a..589c6949906 100755 --- a/tools/marvin/marvin/lib/base.py +++ b/tools/marvin/marvin/lib/base.py @@ -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"] diff --git a/tools/marvin/marvin/lib/common.py b/tools/marvin/marvin/lib/common.py index 71fc274ea22..b9d524c7ae1 100644 --- a/tools/marvin/marvin/lib/common.py +++ b/tools/marvin/marvin/lib/common.py @@ -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]