Skip to content

Commit a32692f

Browse files
update environment for serverless index creation in indexmanager, a little clean up in CollectionTest
1 parent becb5fa commit a32692f

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/integration/java/io/pinecone/helpers/IndexManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public static String createNewIndex(Pinecone pinecone, int dimension, String ind
6565
createIndexRequestSpec = new CreateIndexRequestSpec().pod(podSpec);
6666
} else {
6767
ServerlessSpec serverlessSpec =
68-
new ServerlessSpec().cloud(ServerlessSpec.CloudEnum.AWS).region(environment);
68+
new ServerlessSpec().cloud(ServerlessSpec.CloudEnum.AWS).region("us-west-2");
6969
createIndexRequestSpec = new CreateIndexRequestSpec().serverless(serverlessSpec);
7070
}
7171

src/integration/java/io/pinecone/integration/controlPlane/pod/CollectionTest.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
public class CollectionTest {
2626
private static final String indexName = RandomStringBuilder.build("collection-test", 8);
2727
private static final String collectionName = RandomStringBuilder.build("collection-test", 8);
28-
private static final ArrayList<String> indexes = new ArrayList<>();
28+
private static final ArrayList<String> indexesToCleanUp = new ArrayList<>();
2929
private static final IndexMetric indexMetric = IndexMetric.COSINE;
3030
private static final List<String> upsertIds = Arrays.asList("v1", "v2", "v3");
3131
private static final String namespace = RandomStringBuilder.build("ns", 8);
@@ -47,7 +47,7 @@ public static void setUp() throws InterruptedException {
4747
PineconeConnection dataPlaneConnection = createNewIndexAndConnect(controlPlaneClient, indexName, dimension,
4848
indexMetric, spec, true);
4949
VectorServiceGrpc.VectorServiceBlockingStub blockingStub = dataPlaneConnection.getBlockingStub();
50-
indexes.add(indexName);
50+
indexesToCleanUp.add(indexName);
5151

5252
// Sometimes we see grpc failures when upserting so quickly after creating, so retry if so
5353
assertWithRetry(() -> blockingStub.upsert(buildRequiredUpsertRequestByDimension(upsertIds, dimension,
@@ -67,7 +67,7 @@ public static void cleanUp() throws InterruptedException {
6767
Thread.sleep(2500);
6868

6969
// Clean up indexes
70-
for (String index : indexes) {
70+
for (String index : indexesToCleanUp) {
7171
controlPlaneClient.deleteIndex(index);
7272
}
7373

@@ -128,7 +128,8 @@ public void testIndexFromCollectionHappyPath() throws InterruptedException {
128128
CreateIndexRequest newCreateIndexRequest =
129129
new CreateIndexRequest().name(newIndexName).dimension(dimension).metric(indexMetric).spec(spec);
130130
controlPlaneClient.createIndex(newCreateIndexRequest);
131-
indexes.add(newIndexName);
131+
indexesToCleanUp.add(newIndexName);
132+
132133
logger.info("Index " + newIndexName + " created from collection " + collectionName + ". Waiting until index " +
133134
"is ready...");
134135
waitUntilIndexIsReady(controlPlaneClient, newIndexName, 300000);
@@ -158,7 +159,7 @@ public void testIndexFromCollectionHappyPath() throws InterruptedException {
158159
for (String key : upsertIds) {
159160
assert (fetchedVectors.containsVectors(key));
160161
}
161-
}, 1);
162+
});
162163

163164
connection.close();
164165
}
@@ -180,7 +181,7 @@ public void testIndexFromDifferentMetricCollection() throws InterruptedException
180181
CreateIndexRequestSpec spec = new CreateIndexRequestSpec().pod(podSpec);
181182
PineconeConnection dataPlaneConnection = createNewIndexAndConnect(controlPlaneClient, newIndexName, dimension
182183
, targetMetric, spec, false);
183-
indexes.add(newIndexName);
184+
indexesToCleanUp.add(newIndexName);
184185

185186
IndexModel newIndex = controlPlaneClient.describeIndex(newIndexName);
186187
assertEquals(newIndex.getName(), newIndexName);
@@ -265,7 +266,7 @@ public void testCreateCollectionFromNotReadyIndex() throws InterruptedException
265266
CreateIndexRequestSpec spec = new CreateIndexRequestSpec().pod(specPod);
266267
CreateIndexRequest createIndexRequest = new CreateIndexRequest().name(notReadyIndexName).dimension(dimension).metric(IndexMetric.COSINE).spec(spec);
267268
controlPlaneClient.createIndex(createIndexRequest);
268-
indexes.add(notReadyIndexName);
269+
indexesToCleanUp.add(notReadyIndexName);
269270

270271
createCollection(controlPlaneClient, newCollectionName, notReadyIndexName, true);
271272
} catch (PineconeException exception) {

0 commit comments

Comments
 (0)