Skip to content

Commit 8560333

Browse files
committed
reduced the performance requirements when running in GitHub actions
1 parent 87d39fc commit 8560333

2 files changed

Lines changed: 16 additions & 17 deletions

File tree

tests/unit/admin_ui/api/routes/test_Routes__Admin__Info__client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def test_05_health_check_performance(self):
105105
avg_time = duration / num_requests
106106

107107
# Health check should be very fast
108-
assert avg_time < 0.01 # Less than 10ms average
108+
assert avg_time < 0.02 # Less than 20ms average
109109

110110
def test_06_stats_accuracy(self):
111111
"""Test that stats accurately reflect routes"""

tests/unit/admin_ui/api/test_Admin_UI__Fast_API__multiple_workflows.py

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
from unittest import TestCase
2-
3-
from osbot_utils.utils.Dev import pprint
4-
from osbot_utils.utils.Misc import list_set
5-
from starlette.testclient import TestClient
6-
7-
from osbot_fast_api.admin_ui.api.Admin_UI__Config import Admin_UI__Config
8-
from osbot_fast_api.admin_ui.api.Admin_UI__Fast_API import Admin_UI__Fast_API
1+
from unittest import TestCase
2+
from osbot_utils.utils.Env import in_github_action
3+
from osbot_utils.utils.Misc import list_set
4+
from starlette.testclient import TestClient
5+
from osbot_fast_api.admin_ui.api.Admin_UI__Config import Admin_UI__Config
6+
from osbot_fast_api.admin_ui.api.Admin_UI__Fast_API import Admin_UI__Fast_API
97
from osbot_fast_api.admin_ui.api.testing.Admin_UI__Test_Context import Admin_UI__Test_Context
10-
from osbot_fast_api.api.Fast_API import Fast_API
11-
from osbot_fast_api.utils.Fast_API_Server import Fast_API_Server
8+
from osbot_fast_api.api.Fast_API import Fast_API
9+
from osbot_fast_api.utils.Fast_API_Server import Fast_API_Server
1210

1311
import concurrent.futures
1412
import time
@@ -236,12 +234,13 @@ def set_cookie(name):
236234
assert all(r.status_code == 200 for r in results)
237235

238236
# Should complete in reasonable time
239-
assert duration < 1.5 # 100 requests in under 1.5 seconds :)
240-
241-
# Calculate throughput
242-
throughput = len(results) / duration
243-
#print(f"Throughput: {throughput:.1f} requests/second")
244-
assert throughput > 200 # At least 300 req/s
237+
throughput = len(results) / duration # Calculate throughput
238+
if in_github_action():
239+
assert duration < 3 # 100 requests in under 3 seconds
240+
assert throughput > 100 # At least 100 req/s
241+
else:
242+
assert duration < 0.3 # 100 requests in under 0.3 seconds (locally)
243+
assert throughput > 500 # At least 500 req/s (locally)
245244

246245
def test_05_error_handling(self):
247246
"""Test error handling in Admin UI"""

0 commit comments

Comments
 (0)