@@ -99,9 +99,12 @@ def setUpClass(cls):
9999 cls .api_client = cls .testClient .getApiClient ()
100100 cls .services = Services ().services
101101
102+ cls ._cleanup = []
103+
102104 #Get Zone, Domain and templates
103105 cls .rootdomain = get_domain (cls .api_client )
104106 cls .domain = Domain .create (cls .api_client , cls .services ["domain" ])
107+ cls ._cleanup .append (cls .domain )
105108
106109 cls .zone = get_zone (cls .api_client , cls .testClient .getZoneForTests ())
107110 cls .template = get_template (
@@ -177,21 +180,11 @@ def setUp(self):
177180 self .cleanup = []
178181
179182 def tearDown (self ):
180- try :
181- # #Clean up, terminate the created instance, volumes and snapshots
182- cleanup_resources (self .apiclient , self .cleanup )
183- except Exception as e :
184- raise Exception ("Warning: Exception during cleanup : %s" % e )
185- return
183+ super (TestCreateAffinityGroup , self ).tearDownClass ()
186184
187185 @classmethod
188186 def tearDownClass (cls ):
189- try :
190- #Clean up, terminate the created templates
191- cls .domain .delete (cls .api_client , cleanup = True )
192- cleanup_resources (cls .api_client , cls ._cleanup )
193- except Exception as e :
194- raise Exception ("Warning: Exception during cleanup : %s" % e )
187+ super (TestCreateAffinityGroup , cls ).tearDownClass ()
195188
196189 def create_aff_grp (self , api_client = None , aff_grp = None , aff_grp_name = None , projectid = None ):
197190
0 commit comments