CLOUDSTACK-8081: Fixed VM snapshot test cases in test_escalation_instances.py and also dealt cleanup issues
Signed-off-by: SrikanteswaraRao Talluri <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/daabe92a Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/daabe92a Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/daabe92a Branch: refs/heads/master Commit: daabe92a992f072c6305b14b88fcda99e19a7190 Parents: c3508f6 Author: Gaurav Aradhye <[email protected]> Authored: Wed Dec 17 11:32:49 2014 +0530 Committer: SrikanteswaraRao Talluri <[email protected]> Committed: Wed Dec 17 17:28:35 2014 +0530 ---------------------------------------------------------------------- .../component/test_escalations_instances.py | 61 +++++++------------- 1 file changed, 22 insertions(+), 39 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/daabe92a/test/integration/component/test_escalations_instances.py ---------------------------------------------------------------------- diff --git a/test/integration/component/test_escalations_instances.py b/test/integration/component/test_escalations_instances.py index 9f053a1..e79cd3d 100644 --- a/test/integration/component/test_escalations_instances.py +++ b/test/integration/component/test_escalations_instances.py @@ -2113,26 +2113,6 @@ class TestInstances(cloudstackTestCase): cls.api_client, cls.services["service_offerings"]["tiny"] ) - cls.account = Account.create( - cls.api_client, - cls.services["account"], - domainid=cls.domain.id - ) - # Getting authentication for user in newly created Account - cls.user = cls.account.user[0] - cls.userapiclient = cls.testClient.getUserApiClient( - cls.user.username, - cls.domain.name) - # Updating resource Limits - for i in range(0, 8): - Resources.updateLimit( - cls.api_client, - account=cls.account.name, - domainid=cls.domain.id, - max=-1, - resourcetype=i - ) - cls._cleanup.append(cls.account) cls._cleanup.append(cls.service_offering) cls._cleanup.append(cls.disk_offering) except Exception as e: @@ -2144,12 +2124,29 @@ class TestInstances(cloudstackTestCase): self.apiClient = self.testClient.getApiClient() self.cleanup = [] - self.cleanup_vm = [] + self.account = Account.create( + self.apiClient, + self.services["account"], + domainid=self.domain.id + ) + # Getting authentication for user in newly created Account + self.user = self.account.user[0] + self.userapiclient = self.testClient.getUserApiClient( + self.user.username, + self.domain.name) + # Updating resource Limits + for i in range(0, 8): + Resources.updateLimit( + self.api_client, + account=self.account.name, + domainid=self.domain.id, + max=-1, + resourcetype=i + ) + self.cleanup.append(self.account) def tearDown(self): # Clean up, terminate the created resources - for vm in self.cleanup_vm: - vm.delete(self.apiClient, expunge=True) cleanup_resources(self.apiClient, self.cleanup) return @@ -2242,7 +2239,6 @@ class TestInstances(cloudstackTestCase): vm_created, "VM creation failed" ) - self.cleanup.append(vm_created) # Listing all the VMs for a user again for matching zone list_vms_after = VirtualMachine.list( self.userapiclient, @@ -2372,7 +2368,6 @@ class TestInstances(cloudstackTestCase): vm_created, "VM creation failed" ) - self.cleanup.append(vm_created) # Listing all the VMs for a user again list_vms_after = VirtualMachine.list( self.userapiclient, @@ -2535,7 +2530,6 @@ class TestInstances(cloudstackTestCase): vm_created, "VM creation failed" ) - self.cleanup.append(vm_created) # Listing all the VMs for a user again list_vms_after = VirtualMachine.list( self.userapiclient, @@ -2568,6 +2562,7 @@ class TestInstances(cloudstackTestCase): snapshot1 = VmSnapshot.create( self.userapiclient, vm_created.id, + snapshotmemory=True ) self.assertIsNotNone( snapshot1, @@ -2576,6 +2571,7 @@ class TestInstances(cloudstackTestCase): snapshot2 = VmSnapshot.create( self.userapiclient, vm_created.id, + snapshotmemory=True ) self.assertIsNotNone( snapshot2, @@ -2699,7 +2695,6 @@ class TestInstances(cloudstackTestCase): vm_created, "VM creation failed" ) - self.cleanup.append(vm_created) # Listing all the VMs for a user again list_vms_after = VirtualMachine.list( self.userapiclient, @@ -2747,7 +2742,6 @@ class TestInstances(cloudstackTestCase): volume_created, "Volume is not created" ) - self.cleanup.append(volume_created) # Attaching all the volumes created to VM vm_created.attach_volume( self.userapiclient, @@ -2943,7 +2937,6 @@ class TestInstances(cloudstackTestCase): vm_created, "VM creation failed" ) - self.cleanup.append(vm_created) # Listing details of current Service Offering vm_so_list = ServiceOffering.list( self.userapiclient, @@ -3074,7 +3067,6 @@ class TestInstances(cloudstackTestCase): vm_created, "VM creation failed" ) - self.cleanup.append(vm_created) # Listing details of current Service Offering vm_so_list = ServiceOffering.list( self.userapiclient, @@ -3198,7 +3190,6 @@ class TestInstances(cloudstackTestCase): vm_created, "VM creation failed" ) - self.cleanup.append(vm_created) # Listing all the VMs for a user again list_vms_after = VirtualMachine.list( self.userapiclient, @@ -3326,7 +3317,6 @@ class TestInstances(cloudstackTestCase): vm_created, "VM creation failed" ) - self.cleanup.append(vm_created) # Verifying the displayname and group details for deployed VM self.assertEquals( self.services["virtual_machine"]["displayname"], @@ -3425,7 +3415,6 @@ class TestInstances(cloudstackTestCase): vm_created, "VM creation failed" ) - self.cleanup.append(vm_created) # Listing all the VMs for a user again list_vms_after = VirtualMachine.list( self.userapiclient, @@ -3533,7 +3522,6 @@ class TestInstances(cloudstackTestCase): network, "Network creation failed" ) - self.cleanup.append(network) networks_list_size = networks_list_size + 1 # Listing the networks again @@ -3573,7 +3561,6 @@ class TestInstances(cloudstackTestCase): vm_created, "VM creation failed" ) - self.cleanup.insert(-2, vm_created) # Listing all the VMs for a user again list_vms_after = VirtualMachine.list( self.userapiclient, @@ -3693,7 +3680,6 @@ class TestInstances(cloudstackTestCase): vm_created, "VM creation failed" ) - self.cleanup_vm.append(vm_created) # Listing all the VMs for a user again list_vms_after = VirtualMachine.list( self.userapiclient, @@ -3797,8 +3783,6 @@ class TestInstances(cloudstackTestCase): vm_created, "VM creation failed" ) - # self.cleanup.append(vm_created) - self.cleanup.append(network) # Listing all the VMs for a user again vm_response = VirtualMachine.list( self.userapiclient, @@ -3921,7 +3905,6 @@ class TestInstances(cloudstackTestCase): vm1, "VM1 creation failed with ip address %s and host name %s" % (vm_ip1, name1)) # self.cleanup.append(vm_created) - self.cleanup.append(network) # Listing all the VMs for a user again vm_response = VirtualMachine.list( self.userapiclient,
