Skip to content

Commit 6674f95

Browse files
Gaurav AradhyeSrikanteswaraRao Talluri
authored andcommitted
CLOUDSTACK-8081: Fixed VM snapshot test cases in test_escalation_instances.py and also dealt cleanup issues
Signed-off-by: SrikanteswaraRao Talluri <talluri@apache.org>
1 parent 831cb11 commit 6674f95

1 file changed

Lines changed: 22 additions & 39 deletions

File tree

‎test/integration/component/test_escalations_instances.py‎

Lines changed: 22 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2113,26 +2113,6 @@ def setUpClass(cls):
21132113
cls.api_client,
21142114
cls.services["service_offerings"]["tiny"]
21152115
)
2116-
cls.account = Account.create(
2117-
cls.api_client,
2118-
cls.services["account"],
2119-
domainid=cls.domain.id
2120-
)
2121-
# Getting authentication for user in newly created Account
2122-
cls.user = cls.account.user[0]
2123-
cls.userapiclient = cls.testClient.getUserApiClient(
2124-
cls.user.username,
2125-
cls.domain.name)
2126-
# Updating resource Limits
2127-
for i in range(0, 8):
2128-
Resources.updateLimit(
2129-
cls.api_client,
2130-
account=cls.account.name,
2131-
domainid=cls.domain.id,
2132-
max=-1,
2133-
resourcetype=i
2134-
)
2135-
cls._cleanup.append(cls.account)
21362116
cls._cleanup.append(cls.service_offering)
21372117
cls._cleanup.append(cls.disk_offering)
21382118
except Exception as e:
@@ -2144,12 +2124,29 @@ def setUp(self):
21442124

21452125
self.apiClient = self.testClient.getApiClient()
21462126
self.cleanup = []
2147-
self.cleanup_vm = []
2127+
self.account = Account.create(
2128+
self.apiClient,
2129+
self.services["account"],
2130+
domainid=self.domain.id
2131+
)
2132+
# Getting authentication for user in newly created Account
2133+
self.user = self.account.user[0]
2134+
self.userapiclient = self.testClient.getUserApiClient(
2135+
self.user.username,
2136+
self.domain.name)
2137+
# Updating resource Limits
2138+
for i in range(0, 8):
2139+
Resources.updateLimit(
2140+
self.api_client,
2141+
account=self.account.name,
2142+
domainid=self.domain.id,
2143+
max=-1,
2144+
resourcetype=i
2145+
)
2146+
self.cleanup.append(self.account)
21482147

21492148
def tearDown(self):
21502149
# Clean up, terminate the created resources
2151-
for vm in self.cleanup_vm:
2152-
vm.delete(self.apiClient, expunge=True)
21532150
cleanup_resources(self.apiClient, self.cleanup)
21542151
return
21552152

@@ -2242,7 +2239,6 @@ def test_13_attach_detach_iso(self):
22422239
vm_created,
22432240
"VM creation failed"
22442241
)
2245-
self.cleanup.append(vm_created)
22462242
# Listing all the VMs for a user again for matching zone
22472243
list_vms_after = VirtualMachine.list(
22482244
self.userapiclient,
@@ -2372,7 +2368,6 @@ def test_14_vm_snapshot_pagination(self):
23722368
vm_created,
23732369
"VM creation failed"
23742370
)
2375-
self.cleanup.append(vm_created)
23762371
# Listing all the VMs for a user again
23772372
list_vms_after = VirtualMachine.list(
23782373
self.userapiclient,
@@ -2535,7 +2530,6 @@ def test_15_revert_vm_to_snapshot(self):
25352530
vm_created,
25362531
"VM creation failed"
25372532
)
2538-
self.cleanup.append(vm_created)
25392533
# Listing all the VMs for a user again
25402534
list_vms_after = VirtualMachine.list(
25412535
self.userapiclient,
@@ -2568,6 +2562,7 @@ def test_15_revert_vm_to_snapshot(self):
25682562
snapshot1 = VmSnapshot.create(
25692563
self.userapiclient,
25702564
vm_created.id,
2565+
snapshotmemory=True
25712566
)
25722567
self.assertIsNotNone(
25732568
snapshot1,
@@ -2576,6 +2571,7 @@ def test_15_revert_vm_to_snapshot(self):
25762571
snapshot2 = VmSnapshot.create(
25772572
self.userapiclient,
25782573
vm_created.id,
2574+
snapshotmemory=True
25792575
)
25802576
self.assertIsNotNone(
25812577
snapshot2,
@@ -2703,7 +2699,6 @@ def test_16_list_vm_volumes_pagination(self):
27032699
vm_created,
27042700
"VM creation failed"
27052701
)
2706-
self.cleanup.append(vm_created)
27072702
# Listing all the VMs for a user again
27082703
list_vms_after = VirtualMachine.list(
27092704
self.userapiclient,
@@ -2751,7 +2746,6 @@ def test_16_list_vm_volumes_pagination(self):
27512746
volume_created,
27522747
"Volume is not created"
27532748
)
2754-
self.cleanup.append(volume_created)
27552749
# Attaching all the volumes created to VM
27562750
vm_created.attach_volume(
27572751
self.userapiclient,
@@ -2947,7 +2941,6 @@ def test_17_running_vm_scaleup(self):
29472941
vm_created,
29482942
"VM creation failed"
29492943
)
2950-
self.cleanup.append(vm_created)
29512944
# Listing details of current Service Offering
29522945
vm_so_list = ServiceOffering.list(
29532946
self.userapiclient,
@@ -3078,7 +3071,6 @@ def test_18_stopped_vm_change_service(self):
30783071
vm_created,
30793072
"VM creation failed"
30803073
)
3081-
self.cleanup.append(vm_created)
30823074
# Listing details of current Service Offering
30833075
vm_so_list = ServiceOffering.list(
30843076
self.userapiclient,
@@ -3202,7 +3194,6 @@ def test_19_create_reset_vm_sshkey(self):
32023194
vm_created,
32033195
"VM creation failed"
32043196
)
3205-
self.cleanup.append(vm_created)
32063197
# Listing all the VMs for a user again
32073198
list_vms_after = VirtualMachine.list(
32083199
self.userapiclient,
@@ -3330,7 +3321,6 @@ def test_20_update_vm_displayname_group(self):
33303321
vm_created,
33313322
"VM creation failed"
33323323
)
3333-
self.cleanup.append(vm_created)
33343324
# Verifying the displayname and group details for deployed VM
33353325
self.assertEquals(
33363326
self.services["virtual_machine"]["displayname"],
@@ -3429,7 +3419,6 @@ def test_21_restore_vm(self):
34293419
vm_created,
34303420
"VM creation failed"
34313421
)
3432-
self.cleanup.append(vm_created)
34333422
# Listing all the VMs for a user again
34343423
list_vms_after = VirtualMachine.list(
34353424
self.userapiclient,
@@ -3537,7 +3526,6 @@ def test_22_deploy_vm_multiple_networks(self):
35373526
network,
35383527
"Network creation failed"
35393528
)
3540-
self.cleanup.append(network)
35413529
networks_list_size = networks_list_size + 1
35423530

35433531
# Listing the networks again
@@ -3577,7 +3565,6 @@ def test_22_deploy_vm_multiple_networks(self):
35773565
vm_created,
35783566
"VM creation failed"
35793567
)
3580-
self.cleanup.insert(-2, vm_created)
35813568
# Listing all the VMs for a user again
35823569
list_vms_after = VirtualMachine.list(
35833570
self.userapiclient,
@@ -3697,7 +3684,6 @@ def test_23_deploy_vm_multiple_securitygroups(self):
36973684
vm_created,
36983685
"VM creation failed"
36993686
)
3700-
self.cleanup_vm.append(vm_created)
37013687
# Listing all the VMs for a user again
37023688
list_vms_after = VirtualMachine.list(
37033689
self.userapiclient,
@@ -3801,8 +3787,6 @@ def test_24_deploy_vm_with_static_ip_ES1662(self):
38013787
vm_created,
38023788
"VM creation failed"
38033789
)
3804-
# self.cleanup.append(vm_created)
3805-
self.cleanup.append(network)
38063790
# Listing all the VMs for a user again
38073791
vm_response = VirtualMachine.list(
38083792
self.userapiclient,
@@ -3925,7 +3909,6 @@ def test_25_ip_reallocation_ES1377(self):
39253909
vm1, "VM1 creation failed with ip address %s and host name %s" %
39263910
(vm_ip1, name1))
39273911
# self.cleanup.append(vm_created)
3928-
self.cleanup.append(network)
39293912
# Listing all the VMs for a user again
39303913
vm_response = VirtualMachine.list(
39313914
self.userapiclient,

0 commit comments

Comments
 (0)