@@ -120,12 +120,7 @@ def setUpClass(cls):
120120
121121 @classmethod
122122 def tearDownClass (cls ):
123- try :
124- # Cleanup resources used
125- cleanup_resources (cls .api_client , cls ._cleanup )
126- except Exception as e :
127- raise Exception ("Warning: Exception during cleanup : %s" % e )
128- return
123+ super (TestResizeVolume , cls ).tearDownClass ()
129124
130125 def setUp (self ):
131126 if self .unsupportedStorageType :
@@ -137,13 +132,7 @@ def setUp(self):
137132 return
138133
139134 def tearDown (self ):
140- try :
141- # Clean up, terminate the created instance, volumes and snapshots
142- cleanup_resources (self .apiclient , self .cleanup )
143- pass
144- except Exception as e :
145- raise Exception ("Warning: Exception during cleanup : %s" % e )
146- return
135+ super (TestResizeVolume , self ).tearDown ()
147136
148137 def updateResourceLimits (self , accountLimit = None , domainLimit = None ):
149138 """Update primary storage limits of the parent domain and its
@@ -153,13 +142,13 @@ def updateResourceLimits(self, accountLimit=None, domainLimit=None):
153142 if domainLimit :
154143 # Update resource limit for domain
155144 Resources .updateLimit (self .apiclient , resourcetype = 10 ,
156- max = domainLimit ,
145+ max = int ( domainLimit ) ,
157146 domainid = self .parent_domain .id )
158147 if accountLimit :
159148 # Update resource limit for domain
160149 Resources .updateLimit (self .apiclient ,
161150 resourcetype = 10 ,
162- max = accountLimit ,
151+ max = int ( accountLimit ) ,
163152 account = self .parentd_admin .name ,
164153 domainid = self .parent_domain .id )
165154 except Exception as e :
@@ -172,14 +161,13 @@ def setupAccounts(self):
172161 services = self .services [
173162 "domain" ],
174163 parentdomainid = self .domain .id )
164+ self .cleanup .append (self .parent_domain )
175165 self .parentd_admin = Account .create (self .apiclient ,
176166 self .services ["account" ],
177167 admin = True ,
178168 domainid = self .parent_domain .id )
179169
180- # Cleanup the resources created at end of test
181170 self .cleanup .append (self .parentd_admin )
182- self .cleanup .append (self .parent_domain )
183171 except Exception as e :
184172 return [FAIL , e ]
185173 return [PASS , None ]
@@ -199,7 +187,6 @@ def test_01_increase_volume_size_within_account_limit(self):
199187 # 6. Resize operation should be successful and primary storage count
200188 # for account should be updated successfully"""
201189
202- # Setting up account and domain hierarchy
203190 result = self .setupAccounts ()
204191 self .assertEqual (result [0 ], PASS , result [1 ])
205192
@@ -220,14 +207,14 @@ def test_01_increase_volume_size_within_account_limit(self):
220207 domainid = self .parent_domain .id ,
221208 serviceofferingid = self .service_offering .id
222209 )
210+ self .cleanup .append (virtualMachine )
223211
224212 volume = Volume .create (
225213 apiclient , self .services ["volume" ],
226214 zoneid = self .zone .id ,
227215 account = self .parentd_admin .name ,
228216 domainid = self .parent_domain .id ,
229217 diskofferingid = self .disk_offering_5_GB .id )
230-
231218 virtualMachine .attach_volume (apiclient , volume = volume )
232219
233220 expectedCount = (templateSize + self .disk_offering_5_GB .disksize )
@@ -291,14 +278,14 @@ def test_02_increase_volume_size_above_account_limit(self):
291278 domainid = self .parent_domain .id ,
292279 serviceofferingid = self .service_offering .id
293280 )
281+ self .cleanup .append (virtualMachine )
294282
295283 volume = Volume .create (
296284 apiclient , self .services ["volume" ],
297285 zoneid = self .zone .id ,
298286 account = self .parentd_admin .name ,
299287 domainid = self .parent_domain .id ,
300288 diskofferingid = self .disk_offering_5_GB .id )
301-
302289 virtualMachine .attach_volume (apiclient , volume = volume )
303290
304291 expectedCount = (templateSize + self .disk_offering_5_GB .disksize )
@@ -355,14 +342,14 @@ def test_03_increase_volume_size_above_domain_limit(self):
355342 domainid = self .parent_domain .id ,
356343 serviceofferingid = self .service_offering .id
357344 )
345+ self .cleanup .append (virtualMachine )
358346
359347 volume = Volume .create (
360348 apiclient , self .services ["volume" ],
361349 zoneid = self .zone .id ,
362350 account = self .parentd_admin .name ,
363351 domainid = self .parent_domain .id ,
364352 diskofferingid = self .disk_offering_5_GB .id )
365-
366353 virtualMachine .attach_volume (apiclient , volume = volume )
367354
368355 expectedCount = (templateSize + self .disk_offering_5_GB .disksize )
0 commit comments