Skip to content
Merged
Show file tree
Hide file tree
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
15 changes: 11 additions & 4 deletions tests/integration/test_eviction_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,17 @@ def slow_evict_victims(*args, **kwargs):
time.sleep(1)
return original_evict_victims(*args, **kwargs)

with patch.object(
self.vcache.vcache_config.eviction_policy,
"_evict_victims",
side_effect=slow_evict_victims,
with (
patch.object(
self.vcache.vcache_config.eviction_policy,
"_evict_victims",
side_effect=slow_evict_victims,
),
patch.object(
self.vcache.vcache_policy.inference_engine,
"create",
return_value="mock response",
),
):
# Fill the cache up to just before the watermark limit
for i in range(self.watermark_limit - 1):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import List
from uuid import uuid4

import chromadb

Expand Down Expand Up @@ -110,7 +111,7 @@ def _init_vector_store(self, embedding_dim: int):
ValueError: If the similarity metric type is invalid.
"""
self.client = chromadb.Client()
collection_name = f"vcache_collection_{id(self)}"
collection_name: str = f"vcache_collection_{uuid4().hex}"
metric_type = self.similarity_metric_type.value
match metric_type:
case "cosine":
Expand All @@ -122,7 +123,7 @@ def _init_vector_store(self, embedding_dim: int):
self.collection = self.client.create_collection(
name=collection_name,
metadata={"dimension": embedding_dim, "hnsw:space": space},
get_or_create=True,
get_or_create=False,
)

def is_empty(self) -> bool:
Expand Down
Loading