Quota test fixes (#5959)

* fixes and cleanups on quota integration test

* text changes in exception messages

Co-authored-by: Daan Hoogland <dahn@onecht.net>
Co-authored-by: sureshanaparti <12028987+sureshanaparti@users.noreply.github.com>
This commit is contained in:
dahn 2022-02-10 14:27:21 +01:00 committed by GitHub
parent bc93163eec
commit 122b018057
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -56,11 +56,7 @@ class TestQuota(cloudstackTestCase):
@classmethod @classmethod
def tearDownClass(cls): def tearDownClass(cls):
try: super(TestQuota, cls).tearDownClass()
cleanup_resources(cls.apiclient, cls._cleanup)
except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e)
return
def setUp(self): def setUp(self):
self.apiclient = self.testClient.getApiClient() self.apiclient = self.testClient.getApiClient()
@ -73,12 +69,7 @@ class TestQuota(cloudstackTestCase):
return return
def tearDown(self): def tearDown(self):
try: super(TestQuota, self).tearDown()
#Clean up, terminate the created templates
cleanup_resources(self.apiclient, self.cleanup)
except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e)
return
#Check quotaTariffList API returning 22 items #Check quotaTariffList API returning 22 items
@attr(tags=["smoke", "advanced"], required_hardware="false") @attr(tags=["smoke", "advanced"], required_hardware="false")
@ -244,10 +235,9 @@ class TestQuota(cloudstackTestCase):
cmd.startdate = today cmd.startdate = today
response = self.apiclient.quotaBalance(cmd) response = self.apiclient.quotaBalance(cmd)
self.debug("Quota Balance on: %s" % response.startdate) self.debug(f"Quota Balance: {response.balance}")
self.debug("is: %s" % response.startquota)
self.assertEqual( response.startquota, 10) self.assertEqual( response.startquota, 0, f"startQuota is supposed to be 0 but was {response.balance.startquota}")
return return
#make credit deposit and check start and end date balances #make credit deposit and check start and end date balances
@ -267,9 +257,8 @@ class TestQuota(cloudstackTestCase):
cmd.enddate = today cmd.enddate = today
response = self.apiclient.quotaBalance(cmd) response = self.apiclient.quotaBalance(cmd)
self.debug("Quota Balance on: %s" % response.startdate) self.debug("Quota Balance: {response.balance}")
self.debug("is: %s" % response.startquota)
self.assertEqual( response.startquota, 0) self.assertEqual( response.balance.startquota, 0, f"startquota was supposed to be 0 but was {response.balance.startquota}")
self.assertEqual( response.endquota, 10) self.assertEqual( response.balance.endquota, 10, f"endquota was supposed to be 10 but was {response.balance.endquota}")
return return