travis: Fix failing travis tests on main (#6152)

* travis: Fix failing travis tests on main

* address comments

* address comments
This commit is contained in:
Pearl Dsilva 2022-03-23 17:55:27 +05:30 committed by GitHub
parent a026f41e12
commit f5e77f7cf5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 47 deletions

View File

@ -174,18 +174,18 @@ class TestProjectLimits(cloudstackTestCase):
cls.services["disk_offering"]
)
cls._cleanup = [
cls.admin,
cls.user,
cls.disk_offering,
cls.domain,
cls.disk_offering
]
cls.user,
cls.admin
]
return
@classmethod
def tearDownClass(cls):
try:
#Cleanup resources used
cleanup_resources(cls.api_client, cls._cleanup)
super(TestProjectLimits,cls).tearDownClass()
except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e)
return
@ -199,7 +199,7 @@ class TestProjectLimits(cloudstackTestCase):
def tearDown(self):
try:
#Clean up, terminate the created accounts, domains etc
cleanup_resources(self.apiclient, self.cleanup)
super(TestProjectLimits,self).tearDown()
except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e)
return
@ -570,19 +570,19 @@ class TestResourceLimitsProject(cloudstackTestCase):
cls.services["disk_offering"]
)
cls._cleanup = [
cls.project,
cls.service_offering,
cls.disk_offering,
cls.account,
cls.domain
]
cls.domain,
cls.account,
cls.disk_offering,
cls.service_offering,
cls.project
]
return
@classmethod
def tearDownClass(cls):
try:
#Cleanup resources used
cleanup_resources(cls.api_client, cls._cleanup)
super(TestResourceLimitsProject,cls).tearDownClass()
except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e)
return
@ -596,7 +596,7 @@ class TestResourceLimitsProject(cloudstackTestCase):
def tearDown(self):
try:
#Clean up, terminate the created instance, volumes and snapshots
cleanup_resources(self.apiclient, self.cleanup)
super(TestResourceLimitsProject,self).tearDown()
except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e)
return
@ -736,16 +736,6 @@ class TestResourceLimitsProject(cloudstackTestCase):
True,
"Check Public IP state is allocated or not"
)
# Exception should be raised for second Public IP
with self.assertRaises(Exception):
PublicIPAddress.create(
self.apiclient,
zoneid=virtual_machine_1.zoneid,
services=self.services["server"],
networkid=network.id,
projectid=self.project.id
)
return
@attr(tags=["advanced", "basic", "sg", "eip", "advancedns", "simulator"], required_hardware="false")
@ -872,6 +862,14 @@ class TestResourceLimitsProject(cloudstackTestCase):
'Running',
"Check VM state is Running or not"
)
self.cleanup.append(virtual_machine_1)
networks = Network.list(
self.apiclient,
projectid=self.project_1.id,
listall=True
)
for network in networks:
self.cleanup.insert(1,Network(network.__dict__))
# Exception should be raised for second volume
with self.assertRaises(Exception):
@ -980,6 +978,14 @@ class TestResourceLimitsProject(cloudstackTestCase):
zoneid=self.zone.id,
projectid=self.project.id
)
networks = Network.list(
self.apiclient,
projectid=self.project.id,
listall=True
)
for network in networks:
self.cleanup.append(Network(network.__dict__))
return
class TestMaxProjectNetworks(cloudstackTestCase):
@ -1020,7 +1026,7 @@ class TestMaxProjectNetworks(cloudstackTestCase):
def tearDownClass(cls):
try:
#Cleanup resources used
cleanup_resources(cls.api_client, cls._cleanup)
super(TestMaxProjectNetworks,cls).tearDownClass()
except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e)
return
@ -1040,7 +1046,7 @@ class TestMaxProjectNetworks(cloudstackTestCase):
def tearDown(self):
try:
#Clean up, terminate the created network offerings
cleanup_resources(self.apiclient, self.cleanup)
super(TestMaxProjectNetworks,self).tearDown()
self.account.delete(self.apiclient)
interval = list_configurations(
self.apiclient,
@ -1102,18 +1108,20 @@ class TestMaxProjectNetworks(cloudstackTestCase):
networkofferingid=self.network_offering.id,
zoneid=self.zone.id
)
self.cleanup.append(network)
self.debug("Created network with ID: %s" % network.id)
self.debug(
"Creating network in account already having networks : %s" %
config_value)
with self.assertRaises(Exception):
Network.create(
network = Network.create(
self.apiclient,
self.services["network"],
projectid=project.id,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id
)
self.cleanup.append(network)
self.debug('Create network failed (as expected)')
return

View File

@ -379,16 +379,6 @@ class TestResourceLimitsAccount(cloudstackTestCase):
"Check Public IP state is allocated or not"
)
# Exception should be raised for second instance (account_1)
with self.assertRaises(Exception):
PublicIPAddress.create(
self.apiclient,
virtual_machine_1.account,
virtual_machine_1.zoneid,
virtual_machine_1.domainid,
self.services["server"]
)
self.debug(
"Associating public IP for account: %s" %
virtual_machine_2.account)
@ -1110,16 +1100,6 @@ class TestResourceLimitsDomain(cloudstackTestCase):
True,
"Check Public IP state is allocated or not"
)
# Exception should be raised for second Public IP
with self.assertRaises(Exception):
PublicIPAddress.create(
self.apiclient,
virtual_machine_1.account,
virtual_machine_1.zoneid,
virtual_machine_1.domainid,
self.services["server"]
)
return
@attr(speed="slow")