Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2C03EDAB2 for ; Sun, 19 May 2013 12:05:40 +0000 (UTC) Received: (qmail 91563 invoked by uid 500); 19 May 2013 12:05:37 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 91364 invoked by uid 500); 19 May 2013 12:05:37 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 89799 invoked by uid 99); 19 May 2013 12:05:33 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 19 May 2013 12:05:33 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 32D04319ACF; Sun, 19 May 2013 12:05:33 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sateesh@apache.org To: commits@cloudstack.apache.org Date: Sun, 19 May 2013 12:06:01 -0000 Message-Id: <6478573da5174fde99e0bbdb825f1786@git.apache.org> In-Reply-To: <036ed2f8bb0f40928d98a7f5ca7962eb@git.apache.org> References: <036ed2f8bb0f40928d98a7f5ca7962eb@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [30/50] [abbrv] git commit: updated refs/heads/vmware-datamodel to d07f875 CLOUDSTACK-2478: Fix test_volumes.py script for BVT failures removed storage type in compute offering and disk offering Signed-off-by: Prasanna Santhanam Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/55d304a5 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/55d304a5 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/55d304a5 Branch: refs/heads/vmware-datamodel Commit: 55d304a5bbca27994c01c0f7c63b6168d2a90f60 Parents: 4d0cea6 Author: SrikanteswaraRao Talluri Authored: Tue May 14 20:06:47 2013 +0530 Committer: Prasanna Santhanam Committed: Fri May 17 14:05:05 2013 +0530 ---------------------------------------------------------------------- test/integration/smoke/test_volumes.py | 84 ++++++++++++++++---------- 1 files changed, 52 insertions(+), 32 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/55d304a5/test/integration/smoke/test_volumes.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_volumes.py b/test/integration/smoke/test_volumes.py index 4bf8203..89b013a 100644 --- a/test/integration/smoke/test_volumes.py +++ b/test/integration/smoke/test_volumes.py @@ -53,19 +53,17 @@ class Services: "displaytext": "Tiny Instance", "cpunumber": 1, "cpuspeed": 100, # in MHz - "memory": 128, # In MBs - "storagetype": "local" + "memory": 260 # In MBs + }, "disk_offering": { "displaytext": "Small", "name": "Small", - "storagetype": "local", "disksize": 1 }, 'resized_disk_offering': { "displaytext": "Resized", "name": "Resized", - "storagetype": "local", "disksize": 3 }, "volume_offerings": { @@ -152,7 +150,7 @@ class TestCreateVolume(cloudstackTestCase): self.dbclient = self.testClient.getDbConnection() self.cleanup = [] - @attr(tags = ["advanced", "advancedns", "smoke"]) + @attr(tags = ["advanced", "advancedns", "smoke", "basic"]) def test_01_create_volume(self): """Test Volume creation for all Disk Offerings (incl. custom) """ @@ -346,8 +344,9 @@ class TestVolumes(cloudstackTestCase): cls.custom_resized_disk_offering, cls.service_offering, cls.disk_offering, + cls.volume, cls.account - ] + ] @classmethod def tearDownClass(cls): @@ -359,14 +358,17 @@ class TestVolumes(cloudstackTestCase): def setUp(self): self.apiClient = self.testClient.getApiClient() self.dbclient = self.testClient.getDbConnection() + self.attached = False self.cleanup = [] def tearDown(self): #Clean up, terminate the created volumes + if self.attached: + self.virtual_machine.detach_volume(self.apiClient, self.volume) cleanup_resources(self.apiClient, self.cleanup) return - @attr(tags = ["advanced", "advancedns", "smoke"]) + @attr(tags = ["advanced", "advancedns", "smoke", "basic"]) def test_02_attach_volume(self): """Attach a created Volume to a Running VM """ @@ -381,7 +383,7 @@ class TestVolumes(cloudstackTestCase): self.virtual_machine.id )) self.virtual_machine.attach_volume(self.apiClient, self.volume) - + self.attached = True list_volume_response = list_volumes( self.apiClient, id=self.volume.id @@ -412,7 +414,7 @@ class TestVolumes(cloudstackTestCase): (self.virtual_machine.ipaddress, e)) return - @attr(tags = ["advanced", "advancedns", "smoke"]) + @attr(tags = ["advanced", "advancedns", "smoke", "basic"]) def test_03_download_attached_volume(self): """Download a Volume attached to a VM """ @@ -423,6 +425,8 @@ class TestVolumes(cloudstackTestCase): self.debug("Extract attached Volume ID: %s" % self.volume.id) + self.virtual_machine.attach_volume(self.apiClient, self.volume) + self.attached = True cmd = extractVolume.extractVolumeCmd() cmd.id = self.volume.id cmd.mode = "HTTP_DOWNLOAD" @@ -432,7 +436,7 @@ class TestVolumes(cloudstackTestCase): with self.assertRaises(Exception): self.apiClient.extractVolume(cmd) - @attr(tags = ["advanced", "advancedns", "smoke"]) + @attr(tags = ["advanced", "advancedns", "smoke", "basic"]) def test_04_delete_attached_volume(self): """Delete a Volume attached to a VM """ @@ -444,19 +448,16 @@ class TestVolumes(cloudstackTestCase): self.debug("Trying to delete attached Volume ID: %s" % self.volume.id) - + self.virtual_machine.attach_volume(self.apiClient, self.volume) + self.attached = True cmd = deleteVolume.deleteVolumeCmd() cmd.id = self.volume.id #Proper exception should be raised; deleting attach VM is not allowed #with self.assertRaises(Exception): - result = self.apiClient.deleteVolume(cmd) - self.assertEqual( - result, - None, - "Check for delete download error while volume is attached" - ) + with self.assertRaises(Exception): + self.apiClient.deleteVolume(cmd) - @attr(tags = ["advanced", "advancedns", "smoke"]) + @attr(tags = ["advanced", "advancedns", "smoke", "basic"]) def test_05_detach_volume(self): """Detach a Volume attached to a VM """ @@ -470,8 +471,9 @@ class TestVolumes(cloudstackTestCase): self.volume.id, self.virtual_machine.id )) - + self.virtual_machine.attach_volume(self.apiClient, self.volume) self.virtual_machine.detach_volume(self.apiClient, self.volume) + self.attached = False #Sleep to ensure the current state will reflected in other calls time.sleep(self.services["sleep"]) list_volume_response = list_volumes( @@ -497,7 +499,7 @@ class TestVolumes(cloudstackTestCase): ) return - @attr(tags = ["advanced", "advancedns", "smoke"]) + @attr(tags = ["advanced", "advancedns", "smoke", "basic"]) def test_06_download_detached_volume(self): """Download a Volume unattached to an VM """ @@ -506,6 +508,10 @@ class TestVolumes(cloudstackTestCase): self.debug("Extract detached Volume ID: %s" % self.volume.id) + self.virtual_machine.attach_volume(self.apiClient, self.volume) + self.virtual_machine.detach_volume(self.apiClient, self.volume) + self.attached = False + cmd = extractVolume.extractVolumeCmd() cmd.id = self.volume.id cmd.mode = "HTTP_DOWNLOAD" @@ -528,7 +534,7 @@ class TestVolumes(cloudstackTestCase): % (extract_vol.url, self.volume.id) ) - @attr(tags = ["advanced", "advancedns", "smoke"]) + @attr(tags = ["advanced", "advancedns", "smoke", "basic"]) def test_07_resize_fail(self): """Verify invalid options fail to Resize a volume""" # Verify the size is the new size is what we wanted it to be. @@ -543,7 +549,7 @@ class TestVolumes(cloudstackTestCase): response = self.apiClient.resizeVolume(cmd) except Exception as ex: #print str(ex) - if "HTTP Error 431:" in str(ex): + if "invalid" in str(ex): success = True self.assertEqual( success, @@ -557,7 +563,7 @@ class TestVolumes(cloudstackTestCase): try: response = self.apiClient.resizeVolume(cmd) except Exception as ex: - if "HTTP Error 431:" in str(ex): + if "invalid" in str(ex): success = True self.assertEqual( success, @@ -576,6 +582,7 @@ class TestVolumes(cloudstackTestCase): ) #attach the volume self.virtual_machine.attach_volume(self.apiClient, self.volume) + self.attached = True #stop the vm if it is on xenserver if self.services['hypervisor'].lower() == "xenserver": self.virtual_machine.stop(self.apiClient) @@ -603,10 +610,11 @@ class TestVolumes(cloudstackTestCase): True, "Verify the volume did not resize" ) - self.virtual_machine.detach_volume(self.apiClient, self.volume) - self.cleanup.append(self.volume) + if self.services['hypervisor'].lower() == "xenserver": + self.virtual_machine.start(self.apiClient) + - @attr(tags = ["advanced", "advancedns", "smoke"]) + @attr(tags = ["advanced", "advancedns", "smoke", "basic"]) def test_08_resize_volume(self): """Resize a volume""" # Verify the size is the new size is what we wanted it to be. @@ -616,6 +624,8 @@ class TestVolumes(cloudstackTestCase): self.virtual_machine.id )) self.virtual_machine.attach_volume(self.apiClient, self.volume) + self.attached = True + if self.services['hypervisor'].lower() == "xenserver": self.virtual_machine.stop(self.apiClient) self.debug("Resize Volume ID: %s" % self.volume.id) @@ -635,7 +645,7 @@ class TestVolumes(cloudstackTestCase): type='DATADISK' ) for vol in list_volume_response: - if vol.id == self.volume.id and vol.size == 3221225472L: + if vol.id == self.volume.id and vol.size == 3221225472L and vol.state == 'Ready': success = True if success: break @@ -649,10 +659,10 @@ class TestVolumes(cloudstackTestCase): "Check if the volume resized appropriately" ) - self.virtual_machine.detach_volume(self.apiClient, self.volume) - self.cleanup.append(self.volume) + if self.services['hypervisor'].lower() == "xenserver": + self.virtual_machine.start(self.apiClient) - @attr(tags = ["advanced", "advancedns", "smoke"]) + @attr(tags = ["advanced", "advancedns", "smoke","basic"]) def test_09_delete_detached_volume(self): """Delete a Volume unattached to an VM """ @@ -665,13 +675,23 @@ class TestVolumes(cloudstackTestCase): self.debug("Delete Volume ID: %s" % self.volume.id) + self.volume_1 = Volume.create( + self.api_client, + self.services, + account=self.account.name, + domainid=self.account.domainid + ) + + self.virtual_machine.attach_volume(self.apiClient, self.volume_1) + self.virtual_machine.detach_volume(self.apiClient, self.volume_1) + cmd = deleteVolume.deleteVolumeCmd() - cmd.id = self.volume.id + cmd.id = self.volume_1.id self.apiClient.deleteVolume(cmd) list_volume_response = list_volumes( self.apiClient, - id=self.volume.id, + id=self.volume_1.id, type='DATADISK' ) self.assertEqual(