Skip to content

Commit da72bb9

Browse files
pritisarap12wilderrodrigues
authored andcommitted
CLOUDSTACK-8574: Skip testcases for LXC if storagePool type is not RBD
Signed-off-by: wilderrodrigues <wrodrigues@schubergphilis.com> This closes apache#488
1 parent 6f643fc commit da72bb9

1 file changed

Lines changed: 33 additions & 13 deletions

File tree

‎test/integration/component/test_stopped_vm.py‎

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"""
2020
# Import Local Modules
2121
from nose.plugins.attrib import attr
22-
from marvin.cloudstackTestCase import cloudstackTestCase,unittest
22+
from marvin.cloudstackTestCase import cloudstackTestCase
2323
from marvin.lib.utils import cleanup_resources
2424
from marvin.lib.base import (Account,
2525
VirtualMachine,
@@ -55,11 +55,12 @@ def setUpClass(cls):
5555
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
5656

5757
cls.hypervisor = cls.testClient.getHypervisorInfo()
58+
cls.skip = False
5859

5960
if cls.hypervisor.lower() == 'lxc':
6061
if not find_storage_pool_type(cls.apiclient, storagetype='rbd'):
61-
raise unittest.SkipTest("RBD storage type is required for data volumes for LXC")
62-
62+
cls.skip = True
63+
return
6364

6465
cls.template = get_template(
6566
cls.api_client,
@@ -92,6 +93,9 @@ def tearDownClass(cls):
9293

9394
def setUp(self):
9495

96+
if self.skip:
97+
self.skipTest("RBD storage type is required for data volumes for LXC")
98+
9599
self.apiclient = self.testClient.getApiClient()
96100
self.dbclient = self.testClient.getDbConnection()
97101
self.testdata["virtual_machine"]["zoneid"] = self.zone.id
@@ -635,11 +639,11 @@ def test_09_stop_vm_migrate_vol(self):
635639
# 4. Stop the vm
636640
# 5.list primary storages in the cluster , should be more than one
637641
# 6.Migrate voluem to another available primary storage
638-
self.hypervisor = self.testClient.getHypervisorInfo()
639642
if self.hypervisor.lower() in ['lxc']:
640643
self.skipTest(
641644
"vm migrate is not supported in %s" %
642645
self.hypervisor)
646+
643647
clusters = Cluster.list(
644648
self.apiclient,
645649
zoneid=self.zone.id
@@ -752,10 +756,12 @@ def setUpClass(cls):
752756
cls.testdata = cls.testClient.getParsedTestDataConfig()
753757
# Get Zone, Domain and templates
754758
cls.hypervisor = cls.testClient.getHypervisorInfo()
755-
759+
cls.skip = False
760+
756761
if cls.hypervisor.lower() == 'lxc':
757762
if not find_storage_pool_type(cls.apiclient, storagetype='rbd'):
758-
raise unittest.SkipTest("RBD storage type is required for data volumes for LXC")
763+
cls.skip = True
764+
return
759765

760766
cls.domain = get_domain(cls.api_client)
761767
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
@@ -792,6 +798,9 @@ def tearDownClass(cls):
792798

793799
def setUp(self):
794800

801+
if self.skip:
802+
self.skipTest("RBD storage type is required for data volumes for LXC ")
803+
795804
self.apiclient = self.testClient.getApiClient()
796805
self.dbclient = self.testClient.getDbConnection()
797806
self.hypervisor = self.testClient.getHypervisorInfo()
@@ -865,7 +874,6 @@ def test_02_deploy_ha_vm_from_iso(self):
865874
# 1. deployHA enabled Vm using ISO with the startvm parameter=true
866875
# 2. listVM command should return the deployed VM. State of this VM
867876
# should be "Running".
868-
self.hypervisor = self.testClient.getHypervisorInfo()
869877
if self.hypervisor.lower() in ['lxc']:
870878
self.skipTest(
871879
"vm deploy from ISO feature is not supported on %s" %
@@ -923,10 +931,8 @@ def test_03_deploy_ha_vm_iso_startvm_false(self):
923931
# 1. deployHA enabled Vm using ISO with the startvm parameter=false
924932
# 2. listVM command should return the deployed VM. State of this VM
925933
# should be "Stopped".
926-
self.hypervisor = self.testClient.getHypervisorInfo()
927934
if self.hypervisor.lower() in ['lxc']:
928-
self.skipTest(
929-
"vm deploy from ISO feature is not supported on %s" %
935+
self.skipTest("vm deploy from ISO feature is not supported on %s" %
930936
self.hypervisor.lower())
931937

932938
self.debug("Deploying instance in the account: %s" %
@@ -961,10 +967,12 @@ def setUpClass(cls):
961967
cls.testdata = cls.testClient.getParsedTestDataConfig()
962968
# Get Zone, Domain and templates
963969
cls.hypervisor = cls.testClient.getHypervisorInfo()
970+
cls.skip = False
964971

965972
if cls.hypervisor.lower() == 'lxc':
966973
if not find_storage_pool_type(cls.apiclient, storagetype='rbd'):
967-
raise unittest.SkipTest("RBD storage type is required for data volumes for LXC")
974+
cls.skip = True
975+
return
968976

969977
cls.domain = get_domain(cls.api_client)
970978
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
@@ -1000,6 +1008,9 @@ def tearDownClass(cls):
10001008

10011009
def setUp(self):
10021010

1011+
if self.skip:
1012+
self.skipTest("RBD storage type is required for data volumes for LXC")
1013+
10031014
self.apiclient = self.testClient.getApiClient()
10041015
self.dbclient = self.testClient.getDbConnection()
10051016
self.testdata["virtual_machine"]["zoneid"] = self.zone.id
@@ -1123,10 +1134,12 @@ def setUpClass(cls):
11231134
cls.testdata = cls.testClient.getParsedTestDataConfig()
11241135
# Get Zone, Domain and templates
11251136
cls.hypervisor = cls.testClient.getHypervisorInfo()
1137+
cls.skip = False
11261138

11271139
if cls.hypervisor.lower() == 'lxc':
11281140
if not find_storage_pool_type(cls.apiclient, storagetype='rbd'):
1129-
raise unittest.SkipTest("RBD storage type is required for data volumes for LXC")
1141+
cls.skip = True
1142+
return
11301143

11311144
cls.domain = get_domain(cls.api_client)
11321145
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
@@ -1162,6 +1175,9 @@ def tearDownClass(cls):
11621175

11631176
def setUp(self):
11641177

1178+
if self.skip:
1179+
self.skipTest("RBD storage type is required for data volumes for LXC")
1180+
11651181
self.apiclient = self.testClient.getApiClient()
11661182
self.dbclient = self.testClient.getDbConnection()
11671183
self.testdata["virtual_machine"]["zoneid"] = self.zone.id
@@ -1448,10 +1464,11 @@ def setUpClass(cls):
14481464

14491465
cls.testdata = cls.testClient.getParsedTestDataConfig()
14501466
cls.hypervisor = cls.testClient.getHypervisorInfo()
1467+
cls.skip = False
14511468

14521469
if cls.hypervisor.lower() == 'lxc':
14531470
if not find_storage_pool_type(cls.apiclient, storagetype='rbd'):
1454-
raise unittest.SkipTest("RBD storage type is required for data volumes for LXC")
1471+
cls.skip = True
14551472

14561473
# Get Zone, Domain and templates
14571474
cls.domain = get_domain(cls.api_client)
@@ -1491,6 +1508,9 @@ def tearDownClass(cls):
14911508
return
14921509

14931510
def setUp(self):
1511+
if self.skip:
1512+
self.skipTest("RBD storage type is required for data volumes for LXC")
1513+
14941514
self.apiclient = self.testClient.getApiClient()
14951515
self.dbclient = self.testClient.getDbConnection()
14961516
self.cleanup = []

0 commit comments

Comments
 (0)