A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 14, 05:30 UTC
[CI] Fix test_shared_storage_connector_hashes (#25748)
Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
Chauncey committed
Sep 26, 2025 at 20:46 UTC
2827b3f4a37bcd0715d948ee8d3c9e1e1d08da8a
1 file changed
+22
tests/v1/kv_connector/unit/test_nixl_connector.py
+22
@@ -26,6 +26,8 @@ from vllm.distributed.kv_transfer.kv_connector.v1.multi_connector import (
26
from vllm.distributed.kv_transfer.kv_connector.v1.nixl_connector import (
27
KVConnectorRole, NixlAgentMetadata, NixlConnector, NixlConnectorMetadata,
28
NixlConnectorWorker, NixlKVConnectorStats)
29
+from vllm.distributed.kv_transfer.kv_transfer_state import (
30
+ ensure_kv_transfer_shutdown, has_kv_transfer_group)
31
from vllm.forward_context import ForwardContext
32
from vllm.platforms.interface import Platform
33
from vllm.sampling_params import SamplingParams
@@ -35,6 +37,26 @@ from vllm.v1.outputs import KVConnectorOutput, ModelRunnerOutput
37
from .utils import create_request, create_scheduler, create_vllm_config
38
39
40
+@pytest.fixture(scope="module", autouse=True)
41
+def clear_kv_transfer():
42
+ """
43
+ The test cases in this file use `VLLM_ENABLE_V1_MULTIPROCESSING=0`,
44
+ causing the global variable `_KV_CONNECTOR_AGENT`
45
+ to be assigned but never deleted.
46
+
47
+ Since the current pytest process does not terminate and instead
48
+ continues running tests from other files,
49
+ this global variable remains in memory and interferes
50
+ with test cases in other modules.
51
+
52
+ So we use this fixture to ensure that the global variable
53
+ `_KV_CONNECTOR_AGENT` is properly cleaned up after each test.
54
+ """
55
+ yield
56
+ if has_kv_transfer_group():
57
+ ensure_kv_transfer_shutdown()
58
+
59
+
60
class FakeNixlWrapper:
61
"""Mock implementation of NixlWrapper for testing.
62