Skip to content

Commit 1136baf

Browse files
committed
Fix test cleanup error
1 parent 96582c7 commit 1136baf

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

tests/integration/rest_sync/db/control/pod/conftest.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import random
33
import time
44
from pinecone import Pinecone, PodSpec, PodIndexEnvironment
5+
from pinecone.exceptions import NotFoundException
56
from tests.integration.helpers import generate_index_name, generate_collection_name
67

78

@@ -137,8 +138,13 @@ def attempt_delete_collection(client, collection_name):
137138
def attempt_delete_index(client, index_name):
138139
time_waited = 0
139140
while client.has_index(index_name) and time_waited < 120:
140-
if client.describe_index(index_name).delete_protection == "enabled":
141-
client.configure_index(index_name, deletion_protection="disabled")
141+
try:
142+
if client.describe_index(index_name).delete_protection == "enabled":
143+
client.configure_index(index_name, deletion_protection="disabled")
144+
except NotFoundException:
145+
# Index was deleted between has_index check and describe_index call
146+
# Exit the loop since the index no longer exists
147+
break
142148

143149
print(
144150
f"Waiting for index {index_name} to be ready to delete. Waited {time_waited} seconds.."

0 commit comments

Comments
 (0)