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