Skip to content

Commit

Permalink
do not use vectors_count in test and in local mode (#600)
Browse files Browse the repository at this point in the history
* do not use vectors_count in test and in local mode

* fix: remove indexed vectors count comparison in sparse vector tests

* tests: return tests for full snapshot, increase timeout

---------

Co-authored-by: George Panchuk <george.panchuk@qdrant.tech>
  • Loading branch information
generall and joein committed Apr 22, 2024
1 parent a7a798c commit 0ce5ca0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 31 deletions.
2 changes: 1 addition & 1 deletion qdrant_client/local/local_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -1599,7 +1599,7 @@ def info(self) -> models.CollectionInfo:
return models.CollectionInfo(
status=models.CollectionStatus.GREEN,
optimizer_status=models.OptimizersStatusOneOf.OK,
vectors_count=self.count().count * len(self.vectors),
vectors_count=None,
indexed_vectors_count=0, # LocalCollection does not do indexing
points_count=self.count().count,
segments_count=1,
Expand Down
2 changes: 1 addition & 1 deletion tests/congruence_tests/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def compare_collections(
client_1,
client_2,
num_vectors,
attrs=("vectors_count", "indexed_vectors_count", "points_count"),
attrs=("indexed_vectors_count", "points_count"),
collection_name: str = COLLECTION_NAME,
):
collection_1 = client_1.get_collection(collection_name)
Expand Down
25 changes: 5 additions & 20 deletions tests/congruence_tests/test_sparse_updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,7 @@ def test_upsert():
local_client,
remote_client,
UPLOAD_NUM_VECTORS,
attrs=(
"points_count",
"vectors_count",
),
attrs=("points_count",),
)


Expand All @@ -122,10 +119,7 @@ def test_upload_collection():
local_client,
remote_client,
UPLOAD_NUM_VECTORS,
attrs=(
"points_count",
"vectors_count",
),
attrs=("points_count",),
)


Expand Down Expand Up @@ -155,10 +149,7 @@ def test_upload_collection_generators():
local_client,
remote_client,
UPLOAD_NUM_VECTORS,
attrs=(
"points_count",
"vectors_count",
),
attrs=("points_count",),
)


Expand All @@ -178,10 +169,7 @@ def test_upload_points():
local_client,
remote_client,
UPLOAD_NUM_VECTORS,
attrs=(
"points_count",
"vectors_count",
),
attrs=("points_count",),
)


Expand Down Expand Up @@ -213,8 +201,5 @@ def test_upload_uuid_in_batches():
local_client,
remote_client,
UPLOAD_NUM_VECTORS,
attrs=(
"points_count",
"vectors_count",
),
attrs=("points_count",),
)
12 changes: 3 additions & 9 deletions tests/test_async_qdrant_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ async def test_async_grpc():
@pytest.mark.parametrize("prefer_grpc", [True, False])
async def test_async_qdrant_client(prefer_grpc):
version = os.getenv("QDRANT_VERSION")
client = AsyncQdrantClient(prefer_grpc=prefer_grpc)
client = AsyncQdrantClient(prefer_grpc=prefer_grpc, timeout=15)
collection_params = dict(
collection_name=COLLECTION_NAME,
vectors_config=models.VectorParams(size=10, distance=models.Distance.EUCLID),
Expand Down Expand Up @@ -244,21 +244,15 @@ async def test_async_qdrant_client(prefer_grpc):
# await client.recover_snapshot(collection_name=COLLECTION_NAME, location=...)
# assert (await client.get_collection(COLLECTION_NAME)).vectors_count == 100

await client.delete_snapshot(COLLECTION_NAME, snapshot_name=snapshots[0].name)
time.sleep(
0.5
) # wait param is not propagated https://github.com/qdrant/qdrant-client/issues/254
await client.delete_snapshot(COLLECTION_NAME, snapshot_name=snapshots[0].name, wait=True)

assert len(await client.list_snapshots(COLLECTION_NAME)) == 0

assert isinstance(await client.create_full_snapshot(), models.SnapshotDescription)
snapshots = await client.list_full_snapshots()
assert len(snapshots) == 1

await client.delete_full_snapshot(snapshot_name=snapshots[0].name)
time.sleep(
0.5
) # wait param is not propagated https://github.com/qdrant/qdrant-client/issues/254
await client.delete_full_snapshot(snapshot_name=snapshots[0].name, wait=True)

assert len(await client.list_full_snapshots()) == 0

Expand Down

0 comments on commit 0ce5ca0

Please sign in to comment.