Added a test to verify that listSnapshots response returns zone id

Made changes based on Comments
This closes #632
This commit is contained in:
manasaVeloori 2015-07-29 13:59:15 +05:30 committed by sanjeev
parent bccd344796
commit f45548bf0b

View File

@ -31,6 +31,7 @@ from marvin.lib.common import (get_domain,
list_snapshots) list_snapshots)
from marvin.lib.decoratorGenerators import skipTestIf from marvin.lib.decoratorGenerators import skipTestIf
class TestSnapshotRootDisk(cloudstackTestCase): class TestSnapshotRootDisk(cloudstackTestCase):
@classmethod @classmethod
@ -57,7 +58,8 @@ class TestSnapshotRootDisk(cloudstackTestCase):
cls.services["ostype"] cls.services["ostype"]
) )
if template == FAILED: 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["domainid"] = cls.domain.id
cls.services["server_without_disk"]["zoneid"] = cls.zone.id cls.services["server_without_disk"]["zoneid"] = cls.zone.id
@ -83,6 +85,7 @@ class TestSnapshotRootDisk(cloudstackTestCase):
templateid=template.id, templateid=template.id,
accountid=cls.account.name, accountid=cls.account.name,
domainid=cls.account.domainid, domainid=cls.account.domainid,
zoneid=cls.zone.id,
serviceofferingid=cls.service_offering.id, serviceofferingid=cls.service_offering.id,
mode=cls.services["mode"] mode=cls.services["mode"]
) )
@ -123,6 +126,7 @@ class TestSnapshotRootDisk(cloudstackTestCase):
# the reqd volume under # the reqd volume under
# /secondary/snapshots//$account_id/$volumeid/$snapshot_uuid # /secondary/snapshots//$account_id/$volumeid/$snapshot_uuid
# 3. verify backup_snap_id was non null in the `snapshots` table # 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( volumes = list_volumes(
self.apiclient, self.apiclient,
@ -159,12 +163,21 @@ class TestSnapshotRootDisk(cloudstackTestCase):
snapshot.id, snapshot.id,
"Check resource id in list resources call" "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( 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) % str(snapshot.id)
) )
qresultset = self.dbclient.execute( qresultset = self.dbclient.execute(
"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) % str(snapshot.id)
) )
self.assertNotEqual( self.assertNotEqual(
@ -183,5 +196,6 @@ class TestSnapshotRootDisk(cloudstackTestCase):
"Check if backup_snap_id is not 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 return