Skip to content

Commit

Permalink
Add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
jhamon committed Jan 24, 2024
1 parent ef9a457 commit 280416d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tests/integration/control/pod/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def index_exists(index_name, client):
def random_string():
return ''.join(random.choice(string.ascii_lowercase) for i in range(10))

@pytest.fixture(scope='session', autouse=True)
@pytest.fixture(scope='session')
def reusable_collection():
pc = Pinecone(
api_key=get_environment_var('PINECONE_API_KEY'),
Expand Down
15 changes: 15 additions & 0 deletions tests/integration/control/pod/test_collections_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,21 @@ def random_string():
return ''.join(random.choice(string.ascii_lowercase) for i in range(10))

class TestCollectionErrorCases:
def test_create_index_with_nonexistent_source_collection(self, client, dimension, metric, environment):
with pytest.raises(Exception) as e:
index_name = 'from-nonexistent-coll-' + random_string()
client.create_index(
name=index_name,
dimension=dimension,
metric=metric,
spec=PodSpec(
environment=environment,
source_collection='doesnotexist'
)
)
client.delete_index(index_name, -1)
assert 'Resource doesnotexist not found' in str(e.value)

def test_create_index_in_mismatched_environment(self, client, dimension, metric, environment, reusable_collection):
envs = [
'eastus-azure',
Expand Down

0 comments on commit 280416d

Please sign in to comment.