Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

✅ add test for multiprocessing flag #399

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions tests/entrypoints/openai/test_basic.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import socket
from http import HTTPStatus

import openai
import pytest
import requests

from vllm import envs
from vllm.version import __version__ as VLLM_VERSION

from ...utils import RemoteOpenAIServer
Expand Down Expand Up @@ -59,3 +61,20 @@ async def test_log_metrics(client: openai.AsyncOpenAI):
response = requests.get(base_url + "/metrics")

assert response.status_code == HTTPStatus.OK


@pytest.mark.asyncio
async def test_fronted_multiprocessing_flag():
# Build server without the flag to disable multiprocessing
with RemoteOpenAIServer("facebook/opt-125m", []), \
socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s, \
pytest.raises(OSError, match="Address already in use"):
# Ensure we see the backend port in use
s.bind(("localhost", envs.VLLM_RPC_PORT))

# Build server with the flag to disable multiprocessing
with RemoteOpenAIServer("facebook/opt-125m",
["--disable-frontend-multiprocessing"]), \
socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
# Ensure the backend port is free -> no multiprocessing is happening
s.bind(("localhost", envs.VLLM_RPC_PORT))
Loading