Skip to content

Commit

Permalink
Use name helpers in more places
Browse files Browse the repository at this point in the history
  • Loading branch information
jhamon committed Oct 19, 2024
1 parent 264d3d4 commit 26d91e5
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions tests/integration/control/pod/test_collections.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import string
import random
import pytest
import time
from pinecone import PodSpec


def random_string():
return "".join(random.choice(string.ascii_lowercase) for i in range(10))
from ...helpers import generate_index_name, generate_collection_name


class TestCollectionsHappyPath:
Expand All @@ -18,7 +14,7 @@ def test_index_to_collection_to_index_happy_path(
vectors = [(str(i), random_vector()) for i in range(num_vectors)]
index.upsert(vectors=vectors)

collection_name = "coll1-" + random_string()
collection_name = generate_collection_name("coll1")
client.create_collection(name=collection_name, source=ready_index)
desc = client.describe_collection(collection_name)
assert desc["name"] == collection_name
Expand Down Expand Up @@ -51,7 +47,7 @@ def test_index_to_collection_to_index_happy_path(
assert desc["size"] > 0

# Create index from collection
index_name = "index-from-collection-" + collection_name
index_name = generate_index_name("index-from-collection-" + collection_name)
print(f"Creating index {index_name} from collection {collection_name}...")
client.create_index(
name=index_name,
Expand Down Expand Up @@ -91,7 +87,7 @@ def test_create_index_with_different_metric_from_orig_index(
metrics = ["cosine", "euclidean", "dotproduct"]
target_metric = random.choice([x for x in metrics if x != metric])

index_name = "from-coll-" + random_string()
index_name = generate_index_name("from-" + reusable_collection)
client.create_index(
name=index_name,
dimension=dimension,
Expand Down

0 comments on commit 26d91e5

Please sign in to comment.