Repository: cloudstack Updated Branches: refs/heads/master 1d99a3809 -> dc3c43e60
CLOUDSTACK-8394: Skipping snapshots test cases for HyperV and LXC Signed-off-by: Gaurav Aradhye <gaurav.arad...@clogeny.com> This closes #212 Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/dc3c43e6 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/dc3c43e6 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/dc3c43e6 Branch: refs/heads/master Commit: dc3c43e607b002b4b30caa992491e3e4e97a847b Parents: 1d99a38 Author: Gaurav Aradhye <gaurav.arad...@clogeny.com> Authored: Thu Apr 30 07:44:21 2015 +0530 Committer: Gaurav Aradhye <gaurav.arad...@clogeny.com> Committed: Thu Apr 30 07:49:14 2015 +0530 ---------------------------------------------------------------------- test/integration/component/test_snapshots.py | 51 ++++++++++++-------- .../component/test_snapshots_improvement.py | 29 ++++++++--- 2 files changed, 53 insertions(+), 27 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dc3c43e6/test/integration/component/test_snapshots.py ---------------------------------------------------------------------- diff --git a/test/integration/component/test_snapshots.py b/test/integration/component/test_snapshots.py index 748f271..4ff5411 100644 --- a/test/integration/component/test_snapshots.py +++ b/test/integration/component/test_snapshots.py @@ -18,7 +18,7 @@ """ # Import Local Modules from nose.plugins.attrib import attr -from marvin.cloudstackTestCase import cloudstackTestCase, unittest +from marvin.cloudstackTestCase import cloudstackTestCase from marvin.lib.base import (Snapshot, Template, @@ -167,9 +167,12 @@ class TestSnapshots(cloudstackTestCase): cls.domain = get_domain(cls.api_client) cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) cls.services['mode'] = cls.zone.networktype - cls.hypervisor = cls.testClient.getHypervisorInfo() - if cls.hypervisor.lower() in ['lxc']: - raise unittest.SkipTest("snapshots are not supported on %s" % cls.hypervisor.lower()) + cls._cleanup = [] + cls.unsupportedHypervisor = False + cls.hypervisor = get_hypervisor_type(cls.api_client) + if cls.hypervisor.lower() in ['hyperv', 'lxc']: + cls.unsupportedHypervisor = True + return cls.disk_offering = DiskOffering.create( cls.api_client, cls.services["disk_offering"] @@ -196,9 +199,6 @@ class TestSnapshots(cloudstackTestCase): cls.services["service_offering"] ) - # Get Hypervisor Type - cls.hypervisor = (get_hypervisor_type(cls.api_client)).lower() - cls._cleanup = [ cls.service_offering, cls.disk_offering @@ -216,8 +216,13 @@ class TestSnapshots(cloudstackTestCase): def setUp(self): self.apiclient = self.testClient.getApiClient() - self.hypervisor = str(self.testClient.getHypervisorInfo()).lower() self.dbclient = self.testClient.getDbConnection() + self.cleanup = [] + + if self.unsupportedHypervisor: + self.skipTest("Skipping test because unsupported hypervisor: %s" % + self.hypervisor) + # Create VMs, NAT Rules etc self.account = Account.create( @@ -225,6 +230,7 @@ class TestSnapshots(cloudstackTestCase): self.services["account"], domainid=self.domain.id ) + self.cleanup.append(self.account) self.virtual_machine = self.virtual_machine_with_disk = \ VirtualMachine.create( @@ -236,7 +242,6 @@ class TestSnapshots(cloudstackTestCase): serviceofferingid=self.service_offering.id, mode=self.services["mode"] ) - self.cleanup = [self.account, ] return def tearDown(self): @@ -966,15 +971,17 @@ class TestCreateVMSnapshotTemplate(cloudstackTestCase): TestCreateVMSnapshotTemplate, cls).getClsTestClient() cls.api_client = cls.testClient.getApiClient() - cls.hypervisor = cls.testClient.getHypervisorInfo() + cls._cleanup = [] cls.services = Services().services # Get Zone, Domain and templates cls.domain = get_domain(cls.api_client) cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) cls.services['mode'] = cls.zone.networktype - cls.hypervisor = cls.testClient.getHypervisorInfo() - if cls.hypervisor.lower() in ['lxc']: - raise unittest.SkipTest("snapshots are not supported on %s" % cls.hypervisor.lower()) + cls.unsupportedHypervisor = False + cls.hypervisor = get_hypervisor_type(cls.api_client) + if cls.hypervisor.lower() in ['hyperv', 'lxc']: + cls.unsupportedHypervisor = True + return cls.template = get_template( cls.api_client, @@ -1012,9 +1019,11 @@ class TestCreateVMSnapshotTemplate(cloudstackTestCase): def setUp(self): self.apiclient = self.testClient.getApiClient() - self.hypervisor = str(self.testClient.getHypervisorInfo()).lower() self.dbclient = self.testClient.getDbConnection() self.cleanup = [] + + if self.unsupportedHypervisor: + self.skipTest("snapshots are not supported on %s" % self.hypervisor.lower()) return def tearDown(self): @@ -1183,15 +1192,17 @@ class TestSnapshotEvents(cloudstackTestCase): def setUpClass(cls): cls.testClient = super(TestSnapshotEvents, cls).getClsTestClient() cls.api_client = cls.testClient.getApiClient() - cls.hypervisor = cls.testClient.getHypervisorInfo() cls.services = Services().services + cls._cleanup = [] # Get Zone, Domain and templates cls.domain = get_domain(cls.api_client) cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) cls.services['mode'] = cls.zone.networktype - cls.hypervisor = cls.testClient.getHypervisorInfo() - if cls.hypervisor.lower() in ['lxc']: - raise unittest.SkipTest("snapshots are not supported on %s" % cls.hypervisor.lower()) + cls.unsupportedHypervisor = False + cls.hypervisor = get_hypervisor_type(cls.api_client) + if cls.hypervisor.lower() in ['hyperv', 'lxc']: + cls.unsupportedHypervisor = True + return template = get_template( cls.api_client, @@ -1241,9 +1252,11 @@ class TestSnapshotEvents(cloudstackTestCase): def setUp(self): self.apiclient = self.testClient.getApiClient() - self.hypervisor = str(self.testClient.getHypervisorInfo()).lower() self.dbclient = self.testClient.getDbConnection() self.cleanup = [] + + if self.unsupportedHypervisor: + self.skipTest("snapshots are not supported on %s" % self.hypervisor) return def tearDown(self): http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dc3c43e6/test/integration/component/test_snapshots_improvement.py ---------------------------------------------------------------------- diff --git a/test/integration/component/test_snapshots_improvement.py b/test/integration/component/test_snapshots_improvement.py index 41e8640..4bef4b2 100644 --- a/test/integration/component/test_snapshots_improvement.py +++ b/test/integration/component/test_snapshots_improvement.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 (random_gen, is_snapshot_on_nfs, cleanup_resources) @@ -128,14 +128,17 @@ class TestSnapshotOnRootVolume(cloudstackTestCase): def setUpClass(cls): cls.testClient = super(TestSnapshotOnRootVolume, cls).getClsTestClient() cls.api_client = cls.testClient.getApiClient() + cls._cleanup = [] cls.services = Services().services # Get Zone, Domain and templates cls.domain = get_domain(cls.api_client) cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) + cls.unsupportedHypervisor = False cls.hypervisor = cls.testClient.getHypervisorInfo() - if cls.hypervisor.lower() in ['lxc']: - raise unittest.SkipTest("snapshots are not supported on %s" % cls.hypervisor.lower()) + if cls.hypervisor.lower() in ['hyperv', 'lxc']: + cls.unsupportedHypervisor = True + return cls.template = get_template( cls.api_client, cls.zone.id, @@ -177,6 +180,10 @@ class TestSnapshotOnRootVolume(cloudstackTestCase): self.apiclient = self.testClient.getApiClient() self.dbclient = self.testClient.getDbConnection() self.cleanup = [] + + if self.unsupportedHypervisor: + self.skipTest("snapshots are not supported on %s" % + self.hypervisor) return def tearDown(self): @@ -305,9 +312,12 @@ class TestCreateSnapshot(cloudstackTestCase): def setUpClass(cls): cls.testClient = super(TestCreateSnapshot, cls).getClsTestClient() cls.api_client = cls.testClient.getApiClient() + cls._cleanup = [] + cls.unsupportedHypervisor = False cls.hypervisor = cls.testClient.getHypervisorInfo() if cls.hypervisor.lower() in ['hyperv', 'lxc']: - raise unittest.SkipTest("Snapshots feature is not supported on %s" % cls.hypervisor.lower()) + cls.unsupportedHypervisor = True + return cls.services = Services().services # Get Zone, Domain and templates cls.domain = get_domain(cls.api_client) @@ -326,9 +336,7 @@ class TestCreateSnapshot(cloudstackTestCase): cls.api_client, cls.services["service_offering"] ) - cls._cleanup = [ - cls.service_offering, - ] + cls._cleanup.append(cls.service_offering) return @classmethod @@ -343,17 +351,22 @@ class TestCreateSnapshot(cloudstackTestCase): def setUp(self): self.apiclient = self.testClient.getApiClient() self.dbclient = self.testClient.getDbConnection() + self.cleanup = [] + + if self.unsupportedHypervisor: + self.skipTest("Snapshots are not supported on %s" + % self.hypervisor) self.account = Account.create( self.apiclient, self.services["account"], domainid=self.domain.id ) + self.cleanup.append(self.account) self.apiclient = self.testClient.getUserApiClient( UserName=self.account.name, DomainName=self.account.domain) - self.cleanup = [self.account, ] return def tearDown(self):