Skip to content

Commit

Permalink
tests: test multiple collections scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
joein committed Aug 10, 2023
1 parent a217e43 commit 5cac772
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions qdrant_client/migrate/tests/test_migrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,28 @@ def test_multiple_vectors_collection(
)


def test_multiple_collections(source_client: QdrantClient, dest_client: QdrantClient) -> None:
collection_names = ["collection_1", "collection_2", "collection_3"]
vector_params = models.VectorParams(size=10, distance=models.Distance.COSINE)
for collection_name in collection_names:
source_client.recreate_collection(collection_name, vectors_config=vector_params)
dest_client.recreate_collection(collection_name, vectors_config=vector_params)
source_client.upload_collection(
collection_name,
vectors=np.random.randn(VECTOR_NUMBER, vector_params.size),
)

migrate(source_client, dest_client)

for collection_name in collection_names:
source_vector_number = source_client.get_collection(collection_name).vectors_count
dest_vector_number = dest_client.get_collection(collection_name).vectors_count

assert (
source_vector_number == dest_vector_number == VECTOR_NUMBER
), f"Migration failed. Source vectors count {source_vector_number}, dest vectors count {dest_vector_number}, expected {VECTOR_NUMBER}"


def test_different_distances(source_client: QdrantClient, dest_client: QdrantClient) -> None:
collection_name = "single_vector_collection"
cosine_params = models.VectorParams(size=10, distance=models.Distance.COSINE)
Expand Down

0 comments on commit 5cac772

Please sign in to comment.