Skip to content

Commit 280416d

Browse files
committed
Add test case
1 parent ef9a457 commit 280416d

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

tests/integration/control/pod/conftest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def index_exists(index_name, client):
7373
def random_string():
7474
return ''.join(random.choice(string.ascii_lowercase) for i in range(10))
7575

76-
@pytest.fixture(scope='session', autouse=True)
76+
@pytest.fixture(scope='session')
7777
def reusable_collection():
7878
pc = Pinecone(
7979
api_key=get_environment_var('PINECONE_API_KEY'),

tests/integration/control/pod/test_collections_errors.py

+15
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,21 @@ def random_string():
88
return ''.join(random.choice(string.ascii_lowercase) for i in range(10))
99

1010
class TestCollectionErrorCases:
11+
def test_create_index_with_nonexistent_source_collection(self, client, dimension, metric, environment):
12+
with pytest.raises(Exception) as e:
13+
index_name = 'from-nonexistent-coll-' + random_string()
14+
client.create_index(
15+
name=index_name,
16+
dimension=dimension,
17+
metric=metric,
18+
spec=PodSpec(
19+
environment=environment,
20+
source_collection='doesnotexist'
21+
)
22+
)
23+
client.delete_index(index_name, -1)
24+
assert 'Resource doesnotexist not found' in str(e.value)
25+
1126
def test_create_index_in_mismatched_environment(self, client, dimension, metric, environment, reusable_collection):
1227
envs = [
1328
'eastus-azure',

0 commit comments

Comments
 (0)