|
17 | 17 | """ BVT tests for Volumes |
18 | 18 | """ |
19 | 19 | #Import Local Modules |
20 | | -from marvin.cloudstackTestCase import cloudstackTestCase, unittest |
| 20 | +from marvin.cloudstackTestCase import cloudstackTestCase |
21 | 21 | #from marvin.cloudstackException import * |
22 | 22 | from marvin.cloudstackAPI import (deleteVolume, |
23 | 23 | extractVolume, |
@@ -57,12 +57,16 @@ def setUpClass(cls): |
57 | 57 | # Get Zone, Domain and templates |
58 | 58 | cls.domain = get_domain(cls.apiclient) |
59 | 59 | cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests()) |
| 60 | + cls._cleanup = [] |
60 | 61 | cls.hypervisor = testClient.getHypervisorInfo() |
61 | 62 | cls.services['mode'] = cls.zone.networktype |
| 63 | + cls.invalidStoragePoolType = False |
62 | 64 | #for LXC if the storage pool of type 'rbd' ex: ceph is not available, skip the test |
63 | 65 | if cls.hypervisor.lower() == 'lxc': |
64 | 66 | if not find_storage_pool_type(cls.apiclient, storagetype='rbd'): |
65 | | - raise unittest.SkipTest("RBD storage type is required for data volumes for LXC") |
| 67 | + # RBD storage type is required for data volumes for LXC |
| 68 | + cls.invalidStoragePoolType = True |
| 69 | + return |
66 | 70 | cls.disk_offering = DiskOffering.create( |
67 | 71 | cls.apiclient, |
68 | 72 | cls.services["disk_offering"] |
@@ -120,6 +124,10 @@ def setUp(self): |
120 | 124 | self.dbclient = self.testClient.getDbConnection() |
121 | 125 | self.cleanup = [] |
122 | 126 |
|
| 127 | + if self.invalidStoragePoolType: |
| 128 | + self.skipTest("Skipping test because of valid storage\ |
| 129 | + pool not available") |
| 130 | + |
123 | 131 | @attr(tags = ["advanced", "advancedns", "smoke", "basic"], required_hardware="true") |
124 | 132 | def test_01_create_volume(self): |
125 | 133 | """Test Volume creation for all Disk Offerings (incl. custom) |
@@ -264,16 +272,19 @@ def setUpClass(cls): |
264 | 272 | testClient = super(TestVolumes, cls).getClsTestClient() |
265 | 273 | cls.apiclient = testClient.getApiClient() |
266 | 274 | cls.services = testClient.getParsedTestDataConfig() |
267 | | - |
| 275 | + cls._cleanup = [] |
268 | 276 | # Get Zone, Domain and templates |
269 | 277 | cls.domain = get_domain(cls.apiclient) |
270 | 278 | cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests()) |
271 | 279 | cls.services['mode'] = cls.zone.networktype |
272 | 280 | cls.hypervisor = testClient.getHypervisorInfo() |
| 281 | + cls.invalidStoragePoolType = False |
273 | 282 | #for LXC if the storage pool of type 'rbd' ex: ceph is not available, skip the test |
274 | 283 | if cls.hypervisor.lower() == 'lxc': |
275 | 284 | if not find_storage_pool_type(cls.apiclient, storagetype='rbd'): |
276 | | - raise unittest.SkipTest("RBD storage type is required for data volumes for LXC") |
| 285 | + # RBD storage type is required for data volumes for LXC |
| 286 | + cls.invalidStoragePoolType = True |
| 287 | + return |
277 | 288 | cls.disk_offering = DiskOffering.create( |
278 | 289 | cls.apiclient, |
279 | 290 | cls.services["disk_offering"] |
@@ -321,16 +332,7 @@ def setUpClass(cls): |
321 | 332 | serviceofferingid=cls.service_offering.id, |
322 | 333 | mode=cls.services["mode"] |
323 | 334 | ) |
324 | | - pools = StoragePool.list(cls.apiclient) |
325 | | - # cls.assertEqual( |
326 | | - # validateList(pools)[0], |
327 | | - # PASS, |
328 | | - # "storage pool list validation failed") |
329 | | - |
330 | | - |
331 | 335 |
|
332 | | - if cls.hypervisor.lower() == 'lxc' and cls.storage_pools.type.lower() != 'rbd': |
333 | | - raise unittest.SkipTest("Snapshots not supported on Hyper-V or LXC") |
334 | 336 | cls.volume = Volume.create( |
335 | 337 | cls.apiclient, |
336 | 338 | cls.services, |
@@ -359,6 +361,10 @@ def setUp(self): |
359 | 361 | self.attached = False |
360 | 362 | self.cleanup = [] |
361 | 363 |
|
| 364 | + if self.invalidStoragePoolType: |
| 365 | + self.skipTest("Skipping test because valid storage pool not\ |
| 366 | + available") |
| 367 | + |
362 | 368 | def tearDown(self): |
363 | 369 | #Clean up, terminate the created volumes |
364 | 370 | if self.attached: |
@@ -454,7 +460,7 @@ def test_04_delete_attached_volume(self): |
454 | 460 | #with self.assertRaises(Exception): |
455 | 461 | with self.assertRaises(Exception): |
456 | 462 | self.apiClient.deleteVolume(cmd) |
457 | | - |
| 463 | + |
458 | 464 | @attr(tags = ["advanced", "advancedns", "smoke", "basic"], required_hardware="false") |
459 | 465 | def test_05_detach_volume(self): |
460 | 466 | """Detach a Volume attached to a VM |
@@ -590,7 +596,6 @@ def test_07_resize_fail(self): |
590 | 596 | cmd.id = self.volume.id |
591 | 597 | cmd.diskofferingid = self.services['diskofferingid'] |
592 | 598 | cmd.size = 4 |
593 | | - currentSize = self.volume.size |
594 | 599 |
|
595 | 600 | self.debug( |
596 | 601 | "Attaching volume (ID: %s) to VM (ID: %s)" % ( |
@@ -619,7 +624,7 @@ def test_07_resize_fail(self): |
619 | 624 | if hosts[0].hypervisor == "XenServer": |
620 | 625 | self.virtual_machine.start(self.apiClient) |
621 | 626 | time.sleep(30) |
622 | | - return |
| 627 | + return |
623 | 628 |
|
624 | 629 |
|
625 | 630 | @attr(tags = ["advanced", "advancedns", "smoke", "basic"], required_hardware="true") |
|
0 commit comments