Skip to content

Commit 9a27fef

Browse files
authored
Update configure_index index for new API (#281)
## Problem The shape of the configure_index shape has changed, so we need to pass different stuff. ## Solution - Construct new request body - Add minimal integration test. I just want to see the request succeed for now. The time needed for changes to take effect is variable, and I'm in a bit of a rush. So I don't want to do a bunch of polling for status updates in my test to verify the server actually did the correct thing. - Delete some other legacy tests in `integ/` that have been disabled for a while now. ## Type of Change - [x] Bug fix (non-breaking change which fixes an issue) ## Test Plan New test added.
1 parent 44fc7ed commit 9a27fef

File tree

5 files changed

+18
-142
lines changed

5 files changed

+18
-142
lines changed

pinecone/control/pinecone.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
CreateCollectionRequest,
1313
CreateIndexRequest,
1414
ConfigureIndexRequest,
15+
ConfigureIndexRequestSpec,
16+
ConfigureIndexRequestSpecPod
1517
)
1618
from pinecone.models import ServerlessSpec, PodSpec, IndexList, CollectionList
1719

@@ -176,7 +178,11 @@ def configure_index(self, name: str, replicas: Optional[int] = None, pod_type: O
176178
config_args.update(pod_type=pod_type)
177179
if replicas:
178180
config_args.update(replicas=replicas)
179-
configure_index_request = ConfigureIndexRequest(**config_args)
181+
configure_index_request = ConfigureIndexRequest(
182+
spec=ConfigureIndexRequestSpec(
183+
pod=ConfigureIndexRequestSpecPod(**config_args)
184+
)
185+
)
180186
api_instance.configure_index(name, configure_index_request=configure_index_request)
181187

182188
def create_collection(self, name: str, source: str):

tests/integ/__init__.py

Whitespace-only changes.

tests/integ/test_index.py

Lines changed: 0 additions & 138 deletions
This file was deleted.

tests/integration/control/conftest.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,12 @@ def create_sl_index_params(index_name, serverless_cloud, serverless_region):
3535
return dict(name=index_name, dimension=10, metric='cosine', spec=spec)
3636

3737
@pytest.fixture()
38-
def create_pod_index_params(index_name, environment):
39-
spec = {
40-
'environment': environment
38+
def create_pod_index_params(index_name, pod_environment):
39+
spec = {
40+
'pod': {
41+
'environment': pod_environment,
42+
'pod_type': 'p1.x1'
43+
}
4144
}
4245
return dict(name=index_name, dimension=10, metric='cosine', spec=spec, timeout=-1)
4346

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import time
2+
class TestCreatePodIndex():
3+
def test_create_pod_index(self, client, ready_pod_index):
4+
time.sleep(30) # Wait a little more, just in case.
5+
client.configure_index(ready_pod_index, replicas=1, pod_type='p1.x1')

0 commit comments

Comments
 (0)