fix: close task3 qdrant and config validation gaps
This commit is contained in:
@@ -2,7 +2,7 @@ from uuid import NAMESPACE_URL, uuid5
|
||||
|
||||
import pytest
|
||||
import requests
|
||||
from qdrant_test_helpers import FakeQdrantHttp, _write_record
|
||||
from qdrant_test_helpers import FakeQdrantHttp, FakeResponse, _write_record
|
||||
|
||||
from tht.adapters.vector.qdrant import QdrantVectorStore, point_id
|
||||
from tht.ports.vector import VectorStoreError
|
||||
@@ -51,6 +51,59 @@ def test_require_existing_refuses_missing_collection_without_mutations():
|
||||
assert [call for call in fake.calls if call[0] == "PUT"] == []
|
||||
|
||||
|
||||
def test_require_existing_preflights_before_existing_hash_scroll():
|
||||
fake = FakeQdrantHttp()
|
||||
original_request = fake.request
|
||||
|
||||
def request(method, url, **kwargs):
|
||||
if method == "POST" and url.endswith("/points/scroll"):
|
||||
return FakeResponse(404, {"status": "error"})
|
||||
return original_request(method, url, **kwargs)
|
||||
|
||||
store = QdrantVectorStore(
|
||||
base_url="http://qdrant:6333", collection="workspace-semantic", workspace_id="demo",
|
||||
workspace_revision="a" * 40, expected_dimension=1024,
|
||||
collection_lifecycle="require_existing", request=request,
|
||||
)
|
||||
|
||||
with pytest.raises(VectorStoreError, match="semantic_index_incompatible"):
|
||||
store.existing_hashes("memory", ["memory"])
|
||||
|
||||
assert [call for call in fake.calls if call[1].endswith("/points/scroll")] == []
|
||||
assert [call for call in fake.calls if call[0] == "PUT"] == []
|
||||
|
||||
|
||||
def test_require_existing_delete_maps_collection_404_after_preflight():
|
||||
fake = FakeQdrantHttp()
|
||||
fake.collection = {"vectors": {"size": 1024, "distance": "Cosine"}}
|
||||
fake.payload_indexes = {
|
||||
"content_hash", "document_id", "kind", "record_key", "record_kind",
|
||||
"vector_generation", "workspace_id", "workspace_revision",
|
||||
}
|
||||
original_request = fake.request
|
||||
deleted = False
|
||||
|
||||
def request(method, url, **kwargs):
|
||||
nonlocal deleted
|
||||
if method == "GET" and url.endswith("/collections/workspace-semantic") and not deleted:
|
||||
response = original_request(method, url, **kwargs)
|
||||
deleted = True
|
||||
fake.collection = None
|
||||
return response
|
||||
if method == "POST" and url.endswith("/points/delete?wait=true"):
|
||||
original_request(method, url, **kwargs)
|
||||
return FakeResponse(404, {"status": "error"})
|
||||
return original_request(method, url, **kwargs)
|
||||
|
||||
store = QdrantVectorStore(
|
||||
base_url="http://qdrant:6333", collection="workspace-semantic", workspace_id="demo",
|
||||
workspace_revision="a" * 40, expected_dimension=1024,
|
||||
collection_lifecycle="require_existing", request=request,
|
||||
)
|
||||
|
||||
with pytest.raises(VectorStoreError, match="semantic_index_incompatible"):
|
||||
store.delete_kinds("memory", ["memory"])
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("dimension", "distance", "indexes", "index_types"),
|
||||
[(384, "Cosine", set(), {}),
|
||||
|
||||
Reference in New Issue
Block a user