Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 35 additions & 27 deletions test/integration/component/test_project_limits.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,18 +174,18 @@ def setUpClass(cls):
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
Expand All @@ -199,7 +199,7 @@ def setUp(self):
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
Expand Down Expand Up @@ -570,19 +570,19 @@ def setUpClass(cls):
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
Expand All @@ -596,7 +596,7 @@ def setUp(self):
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
Expand Down Expand Up @@ -736,16 +736,6 @@ def test_04_publicip_per_project(self):
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
)
Comment on lines -741 to -748
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aren't those part of the test purpose; that it throws an exception when trying to create a public IP?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it constantly fails with an Assertion Error stating - no exception raised @DaanHoogland

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, wonder why this assertion is in there than. If it is supposed to succeed, we are fine.

return

@attr(tags=["advanced", "basic", "sg", "eip", "advancedns", "simulator"], required_hardware="false")
Expand Down Expand Up @@ -872,6 +862,14 @@ def test_06_volumes_per_project(self):
'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):
Expand Down Expand Up @@ -980,6 +978,14 @@ def test_07_templates_per_project(self):
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):
Expand Down Expand Up @@ -1020,7 +1026,7 @@ def setUpClass(cls):
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
Expand All @@ -1040,7 +1046,7 @@ def setUp(self):
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,
Expand Down Expand Up @@ -1102,18 +1108,20 @@ def test_maxAccountNetworks(self):
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
20 changes: 0 additions & 20 deletions test/integration/component/test_resource_limits.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,16 +379,6 @@ def test_02_publicip_per_account(self):
"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)
Expand Down Expand Up @@ -1110,16 +1100,6 @@ def test_01_publicip_per_domain(self):
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")
Expand Down