Skip to content

Commit 013f100

Browse files
Gaurav AradhyeGirish Shilamkar
authored andcommitted
CLOUDSTACK-5635: Fixed issue (Max volumes has been exceeded for domain during test)
1 parent 785931b commit 013f100

1 file changed

Lines changed: 44 additions & 25 deletions

File tree

test/integration/component/test_resource_limits.py

Lines changed: 44 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,29 @@
1717
""" P1 tests for Resource limits
1818
"""
1919
#Import Local Modules
20-
import marvin
2120
from nose.plugins.attrib import attr
22-
from marvin.cloudstackTestCase import *
23-
from marvin.cloudstackAPI import *
24-
from marvin.integration.lib.utils import *
25-
from marvin.integration.lib.base import *
26-
from marvin.integration.lib.common import *
27-
import datetime
21+
from marvin.cloudstackTestCase import cloudstackTestCase
22+
from marvin.integration.lib.base import (VirtualMachine,
23+
Snapshot,
24+
Template,
25+
PublicIPAddress,
26+
Account,
27+
Domain,
28+
Volume,
29+
Network,
30+
DiskOffering,
31+
NetworkOffering,
32+
ServiceOffering,
33+
Configurations)
34+
from marvin.integration.lib.common import (list_volumes,
35+
get_domain,
36+
get_zone,
37+
get_template,
38+
update_resource_limit,
39+
list_configurations,
40+
wait_for_cleanup)
41+
from marvin.integration.lib.utils import cleanup_resources
42+
import time
2843

2944

3045
class Services:
@@ -174,6 +189,8 @@ def tearDown(self):
174189
try:
175190
#Clean up, terminate the created instance, volumes and snapshots
176191
cleanup_resources(self.apiclient, self.cleanup)
192+
# Wait for VMs to expunge
193+
wait_for_cleanup(self.apiclient, ["expunge.delay", "expunge.interval"])
177194
except Exception as e:
178195
raise Exception("Warning: Exception during cleanup : %s" % e)
179196
return
@@ -362,13 +379,13 @@ def test_02_publicip_per_account(self):
362379

363380
# Exception should be raised for second instance (account_1)
364381
with self.assertRaises(Exception):
365-
public_ip_2 = PublicIPAddress.create(
366-
self.apiclient,
367-
virtual_machine_1.account,
368-
virtual_machine_1.zoneid,
369-
virtual_machine_1.domainid,
370-
self.services["server"]
371-
)
382+
PublicIPAddress.create(
383+
self.apiclient,
384+
virtual_machine_1.account,
385+
virtual_machine_1.zoneid,
386+
virtual_machine_1.domainid,
387+
self.services["server"]
388+
)
372389

373390
self.debug(
374391
"Associating public IP for account: %s" %
@@ -537,7 +554,7 @@ def test_03_snapshots_per_account(self):
537554
self.debug("Creating snapshot from volume: %s" % volumes[0].id)
538555
# Create a snapshot from the ROOTDISK (Account 2)
539556
snapshot_2 = Snapshot.create(self.apiclient,
540-
volumes[0].id,
557+
volume.id,
541558
account=self.account_2.name,
542559
domainid=self.account_2.domainid,
543560
)
@@ -555,7 +572,7 @@ def test_03_snapshots_per_account(self):
555572
self.debug("Creating snapshot from volume: %s" % volumes[0].id)
556573
# Create a second snapshot from the ROOTDISK (Account 2)
557574
snapshot_3 = Snapshot.create(self.apiclient,
558-
volumes[0].id,
575+
volume.id,
559576
account=self.account_2.name,
560577
domainid=self.account_2.domainid,
561578
)
@@ -940,6 +957,8 @@ def tearDown(self):
940957
try:
941958
#Clean up, terminate the created instance, volumes and snapshots
942959
cleanup_resources(self.apiclient, self.cleanup)
960+
# Wait for VMs to expunge
961+
wait_for_cleanup(self.apiclient, ["expunge.delay", "expunge.interval"])
943962
except Exception as e:
944963
raise Exception("Warning: Exception during cleanup : %s" % e)
945964
return
@@ -1071,13 +1090,13 @@ def test_01_publicip_per_domain(self):
10711090

10721091
# Exception should be raised for second Public IP
10731092
with self.assertRaises(Exception):
1074-
public_ip_2 = PublicIPAddress.create(
1075-
self.apiclient,
1076-
virtual_machine_1.account,
1077-
virtual_machine_1.zoneid,
1078-
virtual_machine_1.domainid,
1079-
self.services["server"]
1080-
)
1093+
PublicIPAddress.create(
1094+
self.apiclient,
1095+
virtual_machine_1.account,
1096+
virtual_machine_1.zoneid,
1097+
virtual_machine_1.domainid,
1098+
self.services["server"]
1099+
)
10811100
return
10821101

10831102
@attr(speed="slow")
@@ -1140,7 +1159,7 @@ def test_03_snapshots_per_domain(self):
11401159
self.debug("Creating snapshot from volume: %s" % volumes[0].id)
11411160
# Create a snapshot from the ROOTDISK
11421161
snapshot_1 = Snapshot.create(self.apiclient,
1143-
volumes[0].id,
1162+
volume.id,
11441163
account=self.account.name,
11451164
domainid=self.account.domainid,
11461165
)
@@ -1158,7 +1177,7 @@ def test_03_snapshots_per_domain(self):
11581177
# Exception should be raised for second snapshot
11591178
with self.assertRaises(Exception):
11601179
Snapshot.create(self.apiclient,
1161-
volumes[0].id,
1180+
volume.id,
11621181
account=self.account.name,
11631182
domainid=self.account.domainid,
11641183
)

0 commit comments

Comments
 (0)