From 15b845dc3807111aa496c1ec1a2cc07afd841d0a Mon Sep 17 00:00:00 2001 From: Luis Gaspar Schroeder Date: Fri, 17 Jul 2026 09:36:33 -0700 Subject: [PATCH] fix: isolate CI tests from shared state Co-authored-by: Cursor --- tests/integration/test_eviction_policy.py | 15 +++++++++++---- .../vector_db/strategies/chroma.py | 5 +++-- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/tests/integration/test_eviction_policy.py b/tests/integration/test_eviction_policy.py index 9f979f4..7490c93 100644 --- a/tests/integration/test_eviction_policy.py +++ b/tests/integration/test_eviction_policy.py @@ -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): diff --git a/vcache/vcache_core/cache/embedding_store/vector_db/strategies/chroma.py b/vcache/vcache_core/cache/embedding_store/vector_db/strategies/chroma.py index d00ce08..c352aed 100644 --- a/vcache/vcache_core/cache/embedding_store/vector_db/strategies/chroma.py +++ b/vcache/vcache_core/cache/embedding_store/vector_db/strategies/chroma.py @@ -1,4 +1,5 @@ from typing import List +from uuid import uuid4 import chromadb @@ -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": @@ -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: