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 # Import Local Modules
from nose.plugins.attrib import attr from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import cloudstackTestCase, unittest from marvin.cloudstackTestCase import cloudstackTestCase
from marvin.lib.base import (Snapshot, from marvin.lib.base import (Snapshot,
Template, Template,
@ -167,9 +167,12 @@ class TestSnapshots(cloudstackTestCase):
cls.domain = get_domain(cls.api_client) cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.services['mode'] = cls.zone.networktype cls.services['mode'] = cls.zone.networktype
cls.hypervisor = cls.testClient.getHypervisorInfo() cls._cleanup = []
if cls.hypervisor.lower() in ['lxc']: cls.unsupportedHypervisor = False
raise unittest.SkipTest("snapshots are not supported on %s" % cls.hypervisor.lower()) 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.disk_offering = DiskOffering.create(
cls.api_client, cls.api_client,
cls.services["disk_offering"] cls.services["disk_offering"]
@ -196,9 +199,6 @@ class TestSnapshots(cloudstackTestCase):
cls.services["service_offering"] cls.services["service_offering"]
) )
# Get Hypervisor Type
cls.hypervisor = (get_hypervisor_type(cls.api_client)).lower()
cls._cleanup = [ cls._cleanup = [
cls.service_offering, cls.service_offering,
cls.disk_offering cls.disk_offering
@ -216,8 +216,13 @@ class TestSnapshots(cloudstackTestCase):
def setUp(self): def setUp(self):
self.apiclient = self.testClient.getApiClient() self.apiclient = self.testClient.getApiClient()
self.hypervisor = str(self.testClient.getHypervisorInfo()).lower()
self.dbclient = self.testClient.getDbConnection() 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 # Create VMs, NAT Rules etc
self.account = Account.create( self.account = Account.create(
@ -225,6 +230,7 @@ class TestSnapshots(cloudstackTestCase):
self.services["account"], self.services["account"],
domainid=self.domain.id domainid=self.domain.id
) )
self.cleanup.append(self.account)
self.virtual_machine = self.virtual_machine_with_disk = \ self.virtual_machine = self.virtual_machine_with_disk = \
VirtualMachine.create( VirtualMachine.create(
@ -236,7 +242,6 @@ class TestSnapshots(cloudstackTestCase):
serviceofferingid=self.service_offering.id, serviceofferingid=self.service_offering.id,
mode=self.services["mode"] mode=self.services["mode"]
) )
self.cleanup = [self.account, ]
return return
def tearDown(self): def tearDown(self):
@ -966,15 +971,17 @@ class TestCreateVMSnapshotTemplate(cloudstackTestCase):
TestCreateVMSnapshotTemplate, TestCreateVMSnapshotTemplate,
cls).getClsTestClient() cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient() cls.api_client = cls.testClient.getApiClient()
cls.hypervisor = cls.testClient.getHypervisorInfo() cls._cleanup = []
cls.services = Services().services cls.services = Services().services
# Get Zone, Domain and templates # Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client) cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.services['mode'] = cls.zone.networktype cls.services['mode'] = cls.zone.networktype
cls.hypervisor = cls.testClient.getHypervisorInfo() cls.unsupportedHypervisor = False
if cls.hypervisor.lower() in ['lxc']: cls.hypervisor = get_hypervisor_type(cls.api_client)
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.template = get_template(
cls.api_client, cls.api_client,
@ -1012,9 +1019,11 @@ class TestCreateVMSnapshotTemplate(cloudstackTestCase):
def setUp(self): def setUp(self):
self.apiclient = self.testClient.getApiClient() self.apiclient = self.testClient.getApiClient()
self.hypervisor = str(self.testClient.getHypervisorInfo()).lower()
self.dbclient = self.testClient.getDbConnection() self.dbclient = self.testClient.getDbConnection()
self.cleanup = [] self.cleanup = []
if self.unsupportedHypervisor:
self.skipTest("snapshots are not supported on %s" % self.hypervisor.lower())
return return
def tearDown(self): def tearDown(self):
@ -1183,15 +1192,17 @@ class TestSnapshotEvents(cloudstackTestCase):
def setUpClass(cls): def setUpClass(cls):
cls.testClient = super(TestSnapshotEvents, cls).getClsTestClient() cls.testClient = super(TestSnapshotEvents, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient() cls.api_client = cls.testClient.getApiClient()
cls.hypervisor = cls.testClient.getHypervisorInfo()
cls.services = Services().services cls.services = Services().services
cls._cleanup = []
# Get Zone, Domain and templates # Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client) cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.services['mode'] = cls.zone.networktype cls.services['mode'] = cls.zone.networktype
cls.hypervisor = cls.testClient.getHypervisorInfo() cls.unsupportedHypervisor = False
if cls.hypervisor.lower() in ['lxc']: cls.hypervisor = get_hypervisor_type(cls.api_client)
raise unittest.SkipTest("snapshots are not supported on %s" % cls.hypervisor.lower()) if cls.hypervisor.lower() in ['hyperv', 'lxc']:
cls.unsupportedHypervisor = True
return
template = get_template( template = get_template(
cls.api_client, cls.api_client,
@ -1241,9 +1252,11 @@ class TestSnapshotEvents(cloudstackTestCase):
def setUp(self): def setUp(self):
self.apiclient = self.testClient.getApiClient() self.apiclient = self.testClient.getApiClient()
self.hypervisor = str(self.testClient.getHypervisorInfo()).lower()
self.dbclient = self.testClient.getDbConnection() self.dbclient = self.testClient.getDbConnection()
self.cleanup = [] self.cleanup = []
if self.unsupportedHypervisor:
self.skipTest("snapshots are not supported on %s" % self.hypervisor)
return return
def tearDown(self): def tearDown(self):

View File

@ -19,7 +19,7 @@
""" """
# Import Local Modules # Import Local Modules
from nose.plugins.attrib import attr from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import cloudstackTestCase, unittest from marvin.cloudstackTestCase import cloudstackTestCase
from marvin.lib.utils import (random_gen, from marvin.lib.utils import (random_gen,
is_snapshot_on_nfs, is_snapshot_on_nfs,
cleanup_resources) cleanup_resources)
@ -128,14 +128,17 @@ class TestSnapshotOnRootVolume(cloudstackTestCase):
def setUpClass(cls): def setUpClass(cls):
cls.testClient = super(TestSnapshotOnRootVolume, cls).getClsTestClient() cls.testClient = super(TestSnapshotOnRootVolume, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient() cls.api_client = cls.testClient.getApiClient()
cls._cleanup = []
cls.services = Services().services cls.services = Services().services
# Get Zone, Domain and templates # Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client) cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.unsupportedHypervisor = False
cls.hypervisor = cls.testClient.getHypervisorInfo() cls.hypervisor = cls.testClient.getHypervisorInfo()
if cls.hypervisor.lower() in ['lxc']: if cls.hypervisor.lower() in ['hyperv', 'lxc']:
raise unittest.SkipTest("snapshots are not supported on %s" % cls.hypervisor.lower()) cls.unsupportedHypervisor = True
return
cls.template = get_template( cls.template = get_template(
cls.api_client, cls.api_client,
cls.zone.id, cls.zone.id,
@ -177,6 +180,10 @@ class TestSnapshotOnRootVolume(cloudstackTestCase):
self.apiclient = self.testClient.getApiClient() self.apiclient = self.testClient.getApiClient()
self.dbclient = self.testClient.getDbConnection() self.dbclient = self.testClient.getDbConnection()
self.cleanup = [] self.cleanup = []
if self.unsupportedHypervisor:
self.skipTest("snapshots are not supported on %s" %
self.hypervisor)
return return
def tearDown(self): def tearDown(self):
@ -305,9 +312,12 @@ class TestCreateSnapshot(cloudstackTestCase):
def setUpClass(cls): def setUpClass(cls):
cls.testClient = super(TestCreateSnapshot, cls).getClsTestClient() cls.testClient = super(TestCreateSnapshot, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient() cls.api_client = cls.testClient.getApiClient()
cls._cleanup = []
cls.unsupportedHypervisor = False
cls.hypervisor = cls.testClient.getHypervisorInfo() cls.hypervisor = cls.testClient.getHypervisorInfo()
if cls.hypervisor.lower() in ['hyperv', 'lxc']: 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 cls.services = Services().services
# Get Zone, Domain and templates # Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client) cls.domain = get_domain(cls.api_client)
@ -326,9 +336,7 @@ class TestCreateSnapshot(cloudstackTestCase):
cls.api_client, cls.api_client,
cls.services["service_offering"] cls.services["service_offering"]
) )
cls._cleanup = [ cls._cleanup.append(cls.service_offering)
cls.service_offering,
]
return return
@classmethod @classmethod
@ -343,17 +351,22 @@ class TestCreateSnapshot(cloudstackTestCase):
def setUp(self): def setUp(self):
self.apiclient = self.testClient.getApiClient() self.apiclient = self.testClient.getApiClient()
self.dbclient = self.testClient.getDbConnection() 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.account = Account.create(
self.apiclient, self.apiclient,
self.services["account"], self.services["account"],
domainid=self.domain.id domainid=self.domain.id
) )
self.cleanup.append(self.account)
self.apiclient = self.testClient.getUserApiClient( self.apiclient = self.testClient.getUserApiClient(
UserName=self.account.name, UserName=self.account.name,
DomainName=self.account.domain) DomainName=self.account.domain)
self.cleanup = [self.account, ]
return return
def tearDown(self): def tearDown(self):