cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sanj...@apache.org
Subject git commit: updated refs/heads/master to f45548b
Date Thu, 30 Jul 2015 07:04:55 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master bccd34479 -> f45548bf0


Added a test to verify that listSnapshots response returns zone id

Made changes based on Comments
This closes #632


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/f45548bf
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/f45548bf
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/f45548bf

Branch: refs/heads/master
Commit: f45548bf0ba9bd1a23d10c48bf9d3fe43cbfae30
Parents: bccd344
Author: manasaVeloori <manasa1084@gmail.com>
Authored: Wed Jul 29 13:59:15 2015 +0530
Committer: sanjeev <sanjeev@apache.org>
Committed: Thu Jul 30 12:32:04 2015 +0530

----------------------------------------------------------------------
 test/integration/smoke/test_snapshots.py | 140 ++++++++++++++------------
 1 file changed, 77 insertions(+), 63 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f45548bf/test/integration/smoke/test_snapshots.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_snapshots.py b/test/integration/smoke/test_snapshots.py
index d230c67..2f4c6c0 100644
--- a/test/integration/smoke/test_snapshots.py
+++ b/test/integration/smoke/test_snapshots.py
@@ -31,6 +31,7 @@ from marvin.lib.common import (get_domain,
                                list_snapshots)
 from marvin.lib.decoratorGenerators import skipTestIf
 
+
 class TestSnapshotRootDisk(cloudstackTestCase):
 
     @classmethod
@@ -52,12 +53,13 @@ class TestSnapshotRootDisk(cloudstackTestCase):
         cls._cleanup = []
         if not cls.hypervisorNotSupported:
             template = get_template(
-                            cls.apiclient,
-                            cls.zone.id,
-                            cls.services["ostype"]
-                            )
+                cls.apiclient,
+                cls.zone.id,
+                cls.services["ostype"]
+            )
             if template == FAILED:
-                assert False, "get_template() failed to return template with description
%s" % cls.services["ostype"]
+                assert False, "get_template() failed to return template with description
%s" % cls.services[
+                    "ostype"]
 
             cls.services["domainid"] = cls.domain.id
             cls.services["server_without_disk"]["zoneid"] = cls.zone.id
@@ -66,32 +68,33 @@ class TestSnapshotRootDisk(cloudstackTestCase):
 
             # Create VMs, NAT Rules etc
             cls.account = Account.create(
-                            cls.apiclient,
-                            cls.services["account"],
-                            domainid=cls.domain.id
-                            )
+                cls.apiclient,
+                cls.services["account"],
+                domainid=cls.domain.id
+            )
             cls._cleanup.append(cls.account)
             cls.service_offering = ServiceOffering.create(
-                                            cls.apiclient,
-                                            cls.services["service_offerings"]
-                                            )
+                cls.apiclient,
+                cls.services["service_offerings"]
+            )
             cls._cleanup.append(cls.service_offering)
             cls.virtual_machine = cls.virtual_machine_with_disk = \
-                    VirtualMachine.create(
-                                cls.apiclient,
-                                cls.services["server_without_disk"],
-                                templateid=template.id,
-                                accountid=cls.account.name,
-                                domainid=cls.account.domainid,
-                                serviceofferingid=cls.service_offering.id,
-                                mode=cls.services["mode"]
-                                )
+                VirtualMachine.create(
+                    cls.apiclient,
+                    cls.services["server_without_disk"],
+                    templateid=template.id,
+                    accountid=cls.account.name,
+                    domainid=cls.account.domainid,
+                    zoneid=cls.zone.id,
+                    serviceofferingid=cls.service_offering.id,
+                    mode=cls.services["mode"]
+                )
         return
 
     @classmethod
     def tearDownClass(cls):
         try:
-            #Cleanup resources used
+            # Cleanup resources used
             cleanup_resources(cls.apiclient, cls._cleanup)
         except Exception as e:
             raise Exception("Warning: Exception during cleanup : %s" % e)
@@ -105,14 +108,14 @@ class TestSnapshotRootDisk(cloudstackTestCase):
 
     def tearDown(self):
         try:
-            #Clean up, terminate the created instance, volumes and snapshots
+            # Clean up, terminate the created instance, volumes and snapshots
             cleanup_resources(self.apiclient, self.cleanup)
         except Exception as e:
             raise Exception("Warning: Exception during cleanup : %s" % e)
         return
 
     @skipTestIf("hypervisorNotSupported")
-    @attr(tags = ["advanced", "advancedns", "smoke"], required_hardware="true")
+    @attr(tags=["advanced", "advancedns", "smoke"], required_hardware="true")
     def test_01_snapshot_root_disk(self):
         """Test Snapshot Root Disk
         """
@@ -123,65 +126,76 @@ class TestSnapshotRootDisk(cloudstackTestCase):
         #    the reqd volume under
         #    /secondary/snapshots//$account_id/$volumeid/$snapshot_uuid
         # 3. verify backup_snap_id was non null in the `snapshots` table
+        # 4. Verify that zoneid is returned in listSnapshots API response
 
         volumes = list_volumes(
-                            self.apiclient,
-                            virtualmachineid=self.virtual_machine_with_disk.id,
-                            type='ROOT',
-                            listall=True
-                            )
+            self.apiclient,
+            virtualmachineid=self.virtual_machine_with_disk.id,
+            type='ROOT',
+            listall=True
+        )
 
         snapshot = Snapshot.create(
-                                   self.apiclient,
-                                   volumes[0].id,
-                                   account=self.account.name,
-                                   domainid=self.account.domainid
-                                   )
+            self.apiclient,
+            volumes[0].id,
+            account=self.account.name,
+            domainid=self.account.domainid
+        )
         self.debug("Snapshot created: ID - %s" % snapshot.id)
 
         snapshots = list_snapshots(
-                                  self.apiclient,
-                                  id=snapshot.id
-                                  )
+            self.apiclient,
+            id=snapshot.id
+        )
         self.assertEqual(
-                            isinstance(snapshots, list),
-                            True,
-                            "Check list response returns a valid list"
-                        )
+            isinstance(snapshots, list),
+            True,
+            "Check list response returns a valid list"
+        )
 
         self.assertNotEqual(
-                            snapshots,
-                            None,
-                            "Check if result exists in list item call"
-                            )
+            snapshots,
+            None,
+            "Check if result exists in list item call"
+        )
         self.assertEqual(
-                            snapshots[0].id,
-                            snapshot.id,
-                            "Check resource id in list resources call"
-                        )
+            snapshots[0].id,
+            snapshot.id,
+            "Check resource id in list resources call"
+        )
+
+        self.assertIsNotNone(snapshots[0].zoneid,
+                             "Zone id is not none in listSnapshots")
+        self.assertEqual(
+            snapshots[0].zoneid,
+            self.zone.id,
+            "Check zone id in the list snapshots"
+        )
+
         self.debug(
-            "select backup_snap_id, account_id, volume_id from snapshots where uuid = '%s';"
\
+            "select backup_snap_id, account_id, volume_id from snapshots where uuid = '%s';"
             % str(snapshot.id)
-            )
+        )
         qresultset = self.dbclient.execute(
-                        "select backup_snap_id, account_id, volume_id from snapshots where
uuid = '%s';" \
-                        % str(snapshot.id)
-                        )
+            "select backup_snap_id, account_id, volume_id from snapshots where uuid = '%s';"
+            % str(snapshot.id)
+        )
         self.assertNotEqual(
-                            len(qresultset),
-                            0,
-                            "Check DB Query result set"
-                            )
+            len(qresultset),
+            0,
+            "Check DB Query result set"
+        )
 
         qresult = qresultset[0]
 
         snapshot_uuid = qresult[0]      # backup_snap_id = snapshot UUID
 
         self.assertNotEqual(
-                            str(snapshot_uuid),
-                            'NULL',
-                            "Check if backup_snap_id is not null"
-                        )
+            str(snapshot_uuid),
+            'NULL',
+            "Check if backup_snap_id is not null"
+        )
 
-        self.assertTrue(is_snapshot_on_nfs(self.apiclient, self.dbclient, self.config, self.zone.id,
snapshot.id))
+        self.assertTrue(is_snapshot_on_nfs(
+            self.apiclient, self.dbclient, self.config, self.zone.id, snapshot.id))
         return


Mime
View raw message