Skip to content

Commit

Permalink
fix: extend upload records and upload points tests
Browse files Browse the repository at this point in the history
  • Loading branch information
joein committed Jan 31, 2024
1 parent cee4a43 commit 4440a96
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions tests/test_qdrant_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,22 @@ def test_records_upload(prefer_grpc, parallel):
assert result_count.count < 900
assert result_count.count > 100

records = (Record(id=idx, vector=np.random.rand(DIM).tolist()) for idx in range(NUM_VECTORS))

client.recreate_collection(
collection_name=COLLECTION_NAME,
vectors_config=VectorParams(size=DIM, distance=Distance.DOT),
timeout=TIMEOUT,
)

client.upload_records(
collection_name=COLLECTION_NAME, records=records, parallel=parallel, wait=True
)

collection_info = client.get_collection(collection_name=COLLECTION_NAME)

assert collection_info.points_count == NUM_VECTORS


@pytest.mark.parametrize("prefer_grpc", [False, True])
@pytest.mark.parametrize("parallel", [1, 2])
Expand Down Expand Up @@ -258,6 +274,24 @@ def test_point_upload(prefer_grpc, parallel):
assert result_count.count < 900
assert result_count.count > 100

client.recreate_collection(
collection_name=COLLECTION_NAME,
vectors_config=VectorParams(size=DIM, distance=Distance.DOT),
timeout=TIMEOUT,
)

points = (
PointStruct(id=idx, vector=np.random.rand(DIM).tolist()) for idx in range(NUM_VECTORS)
)

client.upload_points(
collection_name=COLLECTION_NAME, points=points, parallel=parallel, wait=True
)

collection_info = client.get_collection(collection_name=COLLECTION_NAME)

assert collection_info.points_count == NUM_VECTORS


@pytest.mark.parametrize("prefer_grpc", [False, True])
@pytest.mark.parametrize("parallel", [1, 2])
Expand Down

0 comments on commit 4440a96

Please sign in to comment.