Skip to content

Commit

Permalink
pinecone[patch]: integration test debug (#17960)
Browse files Browse the repository at this point in the history
  • Loading branch information
efriis authored Feb 22, 2024
1 parent 9cf6661 commit e237dce
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@ def setup_class(cls) -> None:
if i["name"] == INDEX_NAME:
client.delete_index(INDEX_NAME)
break
if len(index_list) > 0:
time.sleep(DEFAULT_SLEEP) # prevent race with creation
client.create_index(
name=INDEX_NAME,
dimension=DIMENSION,
metric="cosine",
spec=PodSpec(environment=os.environ["PINECONE_ENVIRONMENT"]),
spec=PodSpec(environment="gcp-starter"),
)

cls.index = client.Index(INDEX_NAME)
Expand All @@ -57,12 +59,12 @@ def teardown_class(cls) -> None:
def setup(self) -> None:
# delete all the vectors in the index
print("called") # noqa: T201
self.index.delete(delete_all=True, namespace=NAMESPACE_NAME)
# index_stats = self.index.describe_index_stats()
# for _namespace_name in index_stats["namespaces"].keys():
# self.index.delete(delete_all=True, namespace=_namespace_name)
time.sleep(DEFAULT_SLEEP) # prevent race condition with previous step
# index_stats = self.index.describe_index_stats
try:
self.index.delete(delete_all=True, namespace=NAMESPACE_NAME)
time.sleep(DEFAULT_SLEEP) # prevent race condition with previous step
except Exception:
# if namespace not found
pass

@pytest.fixture
def embedding_openai(self) -> OpenAIEmbeddings:
Expand Down

0 comments on commit e237dce

Please sign in to comment.