CLOUDSTACK-8394: Skipping snapshots test cases for HyperV and LXC

Signed-off-by: Gaurav Aradhye <gaurav.aradhye@clogeny.com>
This closes #212
This commit is contained in:
Gaurav Aradhye 2015-04-30 07:44:21 +05:30
parent 1d99a38096
commit dc3c43e607
2 changed files with 53 additions and 27 deletions

View File

@ -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):

View File

@ -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):