Skip to content
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
10 changes: 9 additions & 1 deletion tests/multimodal/test_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
import multiprocessing as mp
from types import SimpleNamespace
from typing import cast
from unittest.mock import Mock

import numpy as np
Expand Down Expand Up @@ -796,6 +797,7 @@ def test_shm_receiver_requires_sender_handle_for_current_cache_key():

try:
sender_item, _ = sender_cache.get_and_update_item((item, []), mm_hash)
assert sender_item is not None

valid_feature = MultiModalFeatureSpec(
data=sender_item,
Expand Down Expand Up @@ -897,10 +899,12 @@ def test_shm_sender_validates_client_supplied_handles():
handle, _ = sender_cache.get_and_update_item(
(MultiModalKwargsItem.dummy(1024), []), mm_hash
)
assert handle is not None

sender_cache.validate_input_item(handle, mm_hash)
sender_cache.validate_input_item(MultiModalKwargsItem.dummy(16), mm_hash)

signature = handle["signature"].data
signature = cast(list[int], handle["signature"].data)
forged = [
_with_elem(handle, "signature", [signature[0] ^ 1, *signature[1:]]),
_with_elem(handle, "signature", [signature]),
Expand Down Expand Up @@ -934,6 +938,8 @@ def test_shm_receiver_rejects_out_of_range_handle_fields():
handle, _ = sender_cache.get_and_update_item(
(MultiModalKwargsItem.dummy(1024), []), mm_hash
)
assert handle is not None

for key, value in [
("address", -1),
("address", 2**64),
Expand Down Expand Up @@ -967,6 +973,8 @@ def feature(data: MultiModalKwargsItem) -> MultiModalFeatureSpec:

try:
stale_item, _ = sender_cache.get_and_update_item((item, []), mm_hash)
assert stale_item is not None

sender_cache.clear_cache()

# A request still draining after the clear resolves to its own data.
Expand Down
Loading