fix: flaky gunicorn test

This commit is contained in:
Saqib Ansari 2026-01-05 17:01:47 +05:30
parent a9fef72d4e
commit de9c274f39

View file

@ -1108,13 +1108,15 @@ class TestGunicornWorker(IntegrationTestCase):
process = psutil.Process(self.handle.pid)
return sum(c.cpu_percent(1.0) for c in process.children(True)) + process.cpu_percent(1.0)
usage_threshold = 10
self.spawn_gunicorn(["--threads=2"])
self.assertLessEqual(get_total_usage(), 3)
self.assertLessEqual(get_total_usage(), usage_threshold)
# Wake up at least one thread, go idle and check again
path = f"http://{self.TEST_SITE}:{self.port}/api/method/ping"
self.assertEqual(requests.get(path).status_code, 200)
self.assertLessEqual(get_total_usage(), 3)
self.assertLessEqual(get_total_usage(), usage_threshold)
class TestRQWorker(IntegrationTestCase):