fix: flaky gunicorn test
This commit is contained in:
parent
a9fef72d4e
commit
de9c274f39
1 changed files with 4 additions and 2 deletions
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue