mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Added a test to verify that listSnapshots response returns zone id
Made changes based on Comments This closes #632
This commit is contained in:
parent
bccd344796
commit
f45548bf0b
@ -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"]
|
||||||
)
|
)
|
||||||
@ -91,7 +94,7 @@ class TestSnapshotRootDisk(cloudstackTestCase):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
try:
|
try:
|
||||||
#Cleanup resources used
|
# Cleanup resources used
|
||||||
cleanup_resources(cls.apiclient, cls._cleanup)
|
cleanup_resources(cls.apiclient, cls._cleanup)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||||
@ -105,14 +108,14 @@ class TestSnapshotRootDisk(cloudstackTestCase):
|
|||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
try:
|
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)
|
cleanup_resources(self.apiclient, self.cleanup)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||||
return
|
return
|
||||||
|
|
||||||
@skipTestIf("hypervisorNotSupported")
|
@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):
|
def test_01_snapshot_root_disk(self):
|
||||||
"""Test Snapshot Root Disk
|
"""Test Snapshot Root Disk
|
||||||
"""
|
"""
|
||||||
@ -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
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user