test: cover vector store index default isolation

This commit is contained in:
dajiaohuang 2026-09-13 15:10:33 +08:00
parent 9365ffd835
commit 06b380e813

View file

@ -11,9 +11,13 @@ from datetime import datetime, timezone
from unittest.mock import MagicMock
import litellm
from litellm.types.vector_stores import LiteLLM_ManagedVectorStore
from litellm.types.vector_stores import (
IndexCreateLiteLLMParams,
LiteLLM_ManagedVectorStore,
LiteLLM_ManagedVectorStoreIndex,
)
from litellm.vector_stores.main import search
from litellm.vector_stores.vector_store_registry import VectorStoreRegistry
from litellm.vector_stores.vector_store_registry import VectorStoreIndexRegistry, VectorStoreRegistry
@pytest.fixture(autouse=True)
@ -87,6 +91,24 @@ def test_vector_store_registries_do_not_share_default_list():
assert second.vector_stores == []
def test_vector_store_index_registries_do_not_share_default_list():
first = VectorStoreIndexRegistry()
second = VectorStoreIndexRegistry()
first.vector_store_indexes.append(
LiteLLM_ManagedVectorStoreIndex(
id="first",
index_name="first",
litellm_params=IndexCreateLiteLLMParams(
vector_store_index="first",
vector_store_name="first",
),
)
)
assert second.vector_store_indexes == []
def test_add_vector_store_to_registry():
"""Test that add_vector_store_to_registry adds vector store correctly when there are pre-existing stores"""
# Create pre-existing vector stores