[functional] Avoid leaking greenlet in UnifiedLimits tests

The leak tests just start a server create and the finish so I think
the actual conductor thread leaks. If I add a bit of sleep to the end of
these test cases then the leak disappears. Unfortunately adding the
sleep at the greenpool fixture does not have this effect. So instead I
added delete_server calls to the end of these tests as those are nicer
than sleeps and has the same effect regarding the leak.

We are down to 3 leaking functional test

Change-Id: I070390c695283bdd9b87cd879aa2a9257ee7bdfb
This commit is contained in:
Balazs Gibizer
2023-08-25 15:49:52 +02:00
parent d71d2dc219
commit 0ae1802db6

View File

@@ -170,7 +170,8 @@ class UnifiedLimitsTest(integrated_helpers._IntegratedTestBase):
personality = [
{'path': item[0], 'contents': item[1]} for item in files]
server['personality'] = personality
self.api.post_server({'server': server})
server = self.api.post_server({'server': server})
self.api.delete_server(server['id'])
def test_max_injected_file_content_bytes(self):
# Quota is 10 * 1024
@@ -182,7 +183,8 @@ class UnifiedLimitsTest(integrated_helpers._IntegratedTestBase):
server = self._build_server()
personality = [{'path': '/test/path', 'contents': content}]
server['personality'] = personality
self.api.post_server({'server': server})
server = self.api.post_server({'server': server})
self.api.delete_server(server['id'])
def test_max_injected_file_path_bytes(self):
# Quota is 255.
@@ -191,7 +193,8 @@ class UnifiedLimitsTest(integrated_helpers._IntegratedTestBase):
server = self._build_server()
personality = [{'path': path, 'contents': contents}]
server['personality'] = personality
self.api.post_server({'server': server})
server = self.api.post_server({'server': server})
self.api.delete_server(server['id'])
def test_server_group_members(self):
# Create a server group.
@@ -207,7 +210,7 @@ class UnifiedLimitsTest(integrated_helpers._IntegratedTestBase):
server = self._build_server()
hints = {'group': uuids.instance_group}
req = {'server': server, 'os:scheduler_hints': hints}
self.admin_api.post_server(req)
server = self.admin_api.post_server(req)
# Attempt to create another server in the group should fail because we
# are at quota.
@@ -215,3 +218,5 @@ class UnifiedLimitsTest(integrated_helpers._IntegratedTestBase):
client.OpenStackApiException, self.admin_api.post_server, req)
self.assertEqual(403, e.response.status_code)
self.assertIn('server_group_members', e.response.text)
self.admin_api.delete_server(server['id'])