mirror of
https://github.com/ggml-org/llama.cpp.git
synced 2026-08-26 15:16:23 +02:00
tests : speed-up server test suite 3x (#26734)
* tests : speed-up test suite 3x * cont : print 30 slowest tests
This commit is contained in:
@@ -15,7 +15,7 @@ def stop_server_after_each_test():
|
||||
server.stop()
|
||||
|
||||
|
||||
@pytest.fixture(scope="module", autouse=True)
|
||||
def do_something():
|
||||
@pytest.fixture(scope="session", autouse=True)
|
||||
def load_server_presets():
|
||||
# this will be run once per test session, before any tests
|
||||
ServerPreset.load_all()
|
||||
|
||||
@@ -14,10 +14,10 @@ fi
|
||||
if [ $# -lt 1 ]
|
||||
then
|
||||
if [[ "${SLOW_TESTS:-0}" == 1 ]]; then
|
||||
pytest -v -x
|
||||
pytest --durations=30 -v -x
|
||||
else
|
||||
pytest -v -x -m "not slow"
|
||||
pytest --durations=30 -v -x -m "not slow"
|
||||
fi
|
||||
else
|
||||
pytest "$@"
|
||||
pytest --durations=30 "$@"
|
||||
fi
|
||||
|
||||
@@ -85,7 +85,7 @@ def _wait_for_model_status(model_id: str, desired: set[str], timeout: int = 60)
|
||||
last_status = _get_model_status(model_id)
|
||||
if last_status in desired:
|
||||
return last_status
|
||||
time.sleep(1)
|
||||
time.sleep(0.01)
|
||||
raise AssertionError(
|
||||
f"Timed out waiting for {model_id} to reach {desired}, last status: {last_status}"
|
||||
)
|
||||
@@ -460,7 +460,7 @@ def _wait_for_sse_event(collected: list, event_type: str, model: str, timeout: i
|
||||
while time.time() < deadline:
|
||||
if any(e.get("event") == event_type and e.get("model") == model for e in collected):
|
||||
return True
|
||||
time.sleep(0.5)
|
||||
time.sleep(0.01)
|
||||
return False
|
||||
|
||||
|
||||
|
||||
@@ -306,6 +306,7 @@ class ServerProcess:
|
||||
|
||||
# wait for server to start
|
||||
start_time = time.time()
|
||||
last_print_time = start_time
|
||||
while time.time() - start_time < timeout_seconds:
|
||||
try:
|
||||
response = self.make_request("GET", "/health", headers={
|
||||
@@ -320,8 +321,10 @@ class ServerProcess:
|
||||
if self.process.poll() is not None:
|
||||
raise RuntimeError(f"Server process died with return code {self.process.returncode}")
|
||||
|
||||
print(f"Waiting for server to start...")
|
||||
time.sleep(0.5)
|
||||
if time.time() - last_print_time >= 1.0:
|
||||
print(f"Waiting for server to start...")
|
||||
last_print_time = time.time()
|
||||
time.sleep(0.01)
|
||||
raise TimeoutError(f"Server did not start within {timeout_seconds} seconds")
|
||||
|
||||
def stop(self) -> None:
|
||||
|
||||
Reference in New Issue
Block a user