CLOUDSTACK-8893: Fixing script as per the latest functionality

This commit is contained in:
sanjeev 2015-09-22 14:47:37 +05:30
parent 1a474374b9
commit fbc2e2e983

View File

@ -19,7 +19,7 @@
from marvin.codes import FAILED, KVM, PASS
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import cloudstackTestCase
from marvin.lib.utils import random_gen, cleanup_resources, validateList
from marvin.lib.utils import random_gen, cleanup_resources, validateList, is_snapshot_on_nfs
from marvin.lib.base import (Account,
ServiceOffering,
VirtualMachine,
@ -28,7 +28,8 @@ from marvin.lib.base import (Account,
Snapshot)
from marvin.lib.common import (get_zone,
get_domain,
get_template)
get_template,
list_snapshots)
import time
@ -337,6 +338,7 @@ class TestSnapshots(cloudstackTestCase):
def setUp(self):
self.apiclient = self.testClient.getApiClient()
self.dbclient = self.testClient.getDbConnection()
self.cleanup = []
if self.unsupportedHypervisor:
@ -390,9 +392,25 @@ class TestSnapshots(cloudstackTestCase):
self.assertEqual(validateList(volumes)[0], PASS,
"Failed to get root volume of the VM")
volume = volumes[0]
with self.assertRaises(Exception):
Snapshot.create(self.apiclient,
volume_id=volume.id)
snapshot = Snapshot.create(
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.assertEqual(
validateList(snapshots)[0],
PASS,
"Invalid snapshot list"
)
self.assertEqual(
snapshots[0].id,
snapshot.id,
"Check resource id in list resources call"
)
return