Skip to content

Commit 020f324

Browse files
authored
fix: resolve timeout issue in OpenAI tests (#329)
1 parent 4e21de7 commit 020f324

1 file changed

Lines changed: 0 additions & 50 deletions

File tree

tests/entrypoints/openai/test_basic.py

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,10 @@
1414

1515
import asyncio
1616
import os
17-
from http import HTTPStatus
1817

1918
import openai
2019
import pytest
2120
import pytest_asyncio
22-
import requests
2321
from utils import RemoteOpenAIServer
2422

2523
MODEL_DIR = os.getenv("REBEL_VLLM_PRE_COMPILED_DIR")
@@ -139,51 +137,3 @@ async def test_request_wrong_content_type(server: RemoteOpenAIServer):
139137
"Content-Type":
140138
"application/x-www-form-urlencoded"
141139
})
142-
143-
144-
@pytest.mark.parametrize(
145-
"server_args",
146-
[
147-
pytest.param(["--enable-server-load-tracking"],
148-
id="enable-server-load-tracking")
149-
],
150-
indirect=True,
151-
)
152-
@pytest.mark.asyncio
153-
async def test_server_load(server: RemoteOpenAIServer):
154-
# Check initial server load
155-
response = requests.get(server.url_for("load"))
156-
assert response.status_code == HTTPStatus.OK
157-
assert response.json().get("server_load") == 0
158-
159-
def make_long_completion_request():
160-
return requests.post(
161-
server.url_for("v1/completions"),
162-
headers={"Content-Type": "application/json"},
163-
json={
164-
"prompt": "Give me a long story",
165-
"max_tokens": MAX_TOKENS,
166-
"temperature": 0,
167-
},
168-
)
169-
170-
# Start the completion request in a background thread.
171-
completion_future = asyncio.create_task(
172-
asyncio.to_thread(make_long_completion_request))
173-
174-
# Give a short delay to ensure the request has started.
175-
await asyncio.sleep(0.1)
176-
177-
# Check server load while the completion request is running.
178-
response = requests.get(server.url_for("load"))
179-
assert response.status_code == HTTPStatus.OK
180-
assert response.json().get("server_load") == 1
181-
182-
# Wait for the completion request to finish.
183-
await completion_future
184-
await asyncio.sleep(0.1)
185-
186-
# Check server load after the completion request has finished.
187-
response = requests.get(server.url_for("load"))
188-
assert response.status_code == HTTPStatus.OK
189-
assert response.json().get("server_load") == 0

0 commit comments

Comments
 (0)