Skip to content

Commit 6b555d5

Browse files
committed
Test fixes
1 parent 0604616 commit 6b555d5

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

tests/integration/data/test_namespace.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,18 @@ def test_create_namespace(self, idx):
6767
)
6868

6969
# Verify namespace exists by describing it
70-
verify_description = idx.describe_namespace(namespace=test_namespace)
71-
assert verify_description.name == test_namespace
70+
# Namespace may not be immediately available after creation, so retry with backoff
71+
max_retries = 5
72+
retry_delay = 2
73+
for attempt in range(max_retries):
74+
try:
75+
verify_description = idx.describe_namespace(namespace=test_namespace)
76+
assert verify_description.name == test_namespace
77+
break
78+
except Exception:
79+
if attempt == max_retries - 1:
80+
raise
81+
time.sleep(retry_delay)
7282

7383
finally:
7484
# Cleanup
@@ -91,10 +101,11 @@ def test_create_namespace_duplicate(self, idx):
91101
assert description.name == test_namespace
92102

93103
# Try to create duplicate namespace - should raise an error
104+
# GRPC errors raise PineconeException, not PineconeApiException
94105
import pytest
95-
from pinecone.exceptions import PineconeApiException
106+
from pinecone.exceptions import PineconeException
96107

97-
with pytest.raises(PineconeApiException):
108+
with pytest.raises(PineconeException):
98109
idx.create_namespace(name=test_namespace)
99110

100111
finally:

0 commit comments

Comments
 (0)