From fbc2e2e983938e6a16b7e44eb19db9e659b7a570 Mon Sep 17 00:00:00 2001 From: sanjeev Date: Tue, 22 Sep 2015 14:47:37 +0530 Subject: [PATCH] CLOUDSTACK-8893: Fixing script as per the latest functionality --- test/integration/smoke/test_vm_snapshots.py | 32 ++++++++++++++++----- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/test/integration/smoke/test_vm_snapshots.py b/test/integration/smoke/test_vm_snapshots.py index 93f1c3ebd74..79e8173c9c8 100644 --- a/test/integration/smoke/test_vm_snapshots.py +++ b/test/integration/smoke/test_vm_snapshots.py @@ -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