From da72bb9aeb5623913d4698a1b9cde2fee8962829 Mon Sep 17 00:00:00 2001 From: pritisarap12 Date: Tue, 23 Jun 2015 11:33:21 +0530 Subject: [PATCH] CLOUDSTACK-8574: Skip testcases for LXC if storagePool type is not RBD Signed-off-by: wilderrodrigues This closes #488 --- test/integration/component/test_stopped_vm.py | 46 +++++++++++++------ 1 file changed, 33 insertions(+), 13 deletions(-) diff --git a/test/integration/component/test_stopped_vm.py b/test/integration/component/test_stopped_vm.py index 53a92bc3a51..f31b803c27e 100644 --- a/test/integration/component/test_stopped_vm.py +++ b/test/integration/component/test_stopped_vm.py @@ -19,7 +19,7 @@ """ # Import Local Modules from nose.plugins.attrib import attr -from marvin.cloudstackTestCase import cloudstackTestCase,unittest +from marvin.cloudstackTestCase import cloudstackTestCase from marvin.lib.utils import cleanup_resources from marvin.lib.base import (Account, VirtualMachine, @@ -55,11 +55,12 @@ class TestDeployVM(cloudstackTestCase): cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) cls.hypervisor = cls.testClient.getHypervisorInfo() + cls.skip = False if cls.hypervisor.lower() == 'lxc': if not find_storage_pool_type(cls.apiclient, storagetype='rbd'): - raise unittest.SkipTest("RBD storage type is required for data volumes for LXC") - + cls.skip = True + return cls.template = get_template( cls.api_client, @@ -92,6 +93,9 @@ class TestDeployVM(cloudstackTestCase): def setUp(self): + if self.skip: + self.skipTest("RBD storage type is required for data volumes for LXC") + self.apiclient = self.testClient.getApiClient() self.dbclient = self.testClient.getDbConnection() self.testdata["virtual_machine"]["zoneid"] = self.zone.id @@ -635,11 +639,11 @@ class TestDeployVM(cloudstackTestCase): # 4. Stop the vm # 5.list primary storages in the cluster , should be more than one # 6.Migrate voluem to another available primary storage - self.hypervisor = self.testClient.getHypervisorInfo() if self.hypervisor.lower() in ['lxc']: self.skipTest( "vm migrate is not supported in %s" % self.hypervisor) + clusters = Cluster.list( self.apiclient, zoneid=self.zone.id @@ -752,10 +756,12 @@ class TestDeployHaEnabledVM(cloudstackTestCase): cls.testdata = cls.testClient.getParsedTestDataConfig() # Get Zone, Domain and templates cls.hypervisor = cls.testClient.getHypervisorInfo() - + cls.skip = False + if cls.hypervisor.lower() == 'lxc': if not find_storage_pool_type(cls.apiclient, storagetype='rbd'): - raise unittest.SkipTest("RBD storage type is required for data volumes for LXC") + cls.skip = True + return cls.domain = get_domain(cls.api_client) cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) @@ -792,6 +798,9 @@ class TestDeployHaEnabledVM(cloudstackTestCase): def setUp(self): + if self.skip: + self.skipTest("RBD storage type is required for data volumes for LXC ") + self.apiclient = self.testClient.getApiClient() self.dbclient = self.testClient.getDbConnection() self.hypervisor = self.testClient.getHypervisorInfo() @@ -865,7 +874,6 @@ class TestDeployHaEnabledVM(cloudstackTestCase): # 1. deployHA enabled Vm using ISO with the startvm parameter=true # 2. listVM command should return the deployed VM. State of this VM # should be "Running". - self.hypervisor = self.testClient.getHypervisorInfo() if self.hypervisor.lower() in ['lxc']: self.skipTest( "vm deploy from ISO feature is not supported on %s" % @@ -923,10 +931,8 @@ class TestDeployHaEnabledVM(cloudstackTestCase): # 1. deployHA enabled Vm using ISO with the startvm parameter=false # 2. listVM command should return the deployed VM. State of this VM # should be "Stopped". - self.hypervisor = self.testClient.getHypervisorInfo() if self.hypervisor.lower() in ['lxc']: - self.skipTest( - "vm deploy from ISO feature is not supported on %s" % + self.skipTest("vm deploy from ISO feature is not supported on %s" % self.hypervisor.lower()) self.debug("Deploying instance in the account: %s" % @@ -961,10 +967,12 @@ class TestRouterStateAfterDeploy(cloudstackTestCase): cls.testdata = cls.testClient.getParsedTestDataConfig() # Get Zone, Domain and templates cls.hypervisor = cls.testClient.getHypervisorInfo() + cls.skip = False if cls.hypervisor.lower() == 'lxc': if not find_storage_pool_type(cls.apiclient, storagetype='rbd'): - raise unittest.SkipTest("RBD storage type is required for data volumes for LXC") + cls.skip = True + return cls.domain = get_domain(cls.api_client) cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) @@ -1000,6 +1008,9 @@ class TestRouterStateAfterDeploy(cloudstackTestCase): def setUp(self): + if self.skip: + self.skipTest("RBD storage type is required for data volumes for LXC") + self.apiclient = self.testClient.getApiClient() self.dbclient = self.testClient.getDbConnection() self.testdata["virtual_machine"]["zoneid"] = self.zone.id @@ -1123,10 +1134,12 @@ class TestDeployVMBasicZone(cloudstackTestCase): cls.testdata = cls.testClient.getParsedTestDataConfig() # Get Zone, Domain and templates cls.hypervisor = cls.testClient.getHypervisorInfo() + cls.skip = False if cls.hypervisor.lower() == 'lxc': if not find_storage_pool_type(cls.apiclient, storagetype='rbd'): - raise unittest.SkipTest("RBD storage type is required for data volumes for LXC") + cls.skip = True + return cls.domain = get_domain(cls.api_client) cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) @@ -1162,6 +1175,9 @@ class TestDeployVMBasicZone(cloudstackTestCase): def setUp(self): + if self.skip: + self.skipTest("RBD storage type is required for data volumes for LXC") + self.apiclient = self.testClient.getApiClient() self.dbclient = self.testClient.getDbConnection() self.testdata["virtual_machine"]["zoneid"] = self.zone.id @@ -1448,10 +1464,11 @@ class TestUploadAttachVolume(cloudstackTestCase): cls.testdata = cls.testClient.getParsedTestDataConfig() cls.hypervisor = cls.testClient.getHypervisorInfo() + cls.skip = False if cls.hypervisor.lower() == 'lxc': if not find_storage_pool_type(cls.apiclient, storagetype='rbd'): - raise unittest.SkipTest("RBD storage type is required for data volumes for LXC") + cls.skip = True # Get Zone, Domain and templates cls.domain = get_domain(cls.api_client) @@ -1491,6 +1508,9 @@ class TestUploadAttachVolume(cloudstackTestCase): return def setUp(self): + if self.skip: + self.skipTest("RBD storage type is required for data volumes for LXC") + self.apiclient = self.testClient.getApiClient() self.dbclient = self.testClient.getDbConnection() self.cleanup = []