Skip to content

Commit

Permalink
add remaining changes for future reference but close this branch
Browse files Browse the repository at this point in the history
  • Loading branch information
rohanshah18 committed Nov 17, 2023
1 parent 63362e3 commit 447b28b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.pinecone.ControlPlane;

import io.pinecone.PineconeClientConfig;
import io.pinecone.DataPlane.SyncStubTest;
import io.pinecone.PineconeIndexOperationClient;
import io.pinecone.exceptions.PineconeBadRequestException;
import io.pinecone.exceptions.PineconeNotFoundException;
Expand All @@ -20,7 +19,7 @@
public class ConfigureIndexTest {
private PineconeIndexOperationClient pinecone;
private String indexName;
private static final Logger logger = LoggerFactory.getLogger(SyncStubTest.class);
private static final Logger logger = LoggerFactory.getLogger(ConfigureIndexTest.class);

@BeforeEach
public void setUp() throws IOException {
Expand Down
22 changes: 14 additions & 8 deletions src/integration/java/io/pinecone/DataPlane/FutureStubTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.ExecutionException;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
Expand All @@ -27,6 +28,9 @@ public class FutureStubTest {

private PineconeClient dataPlaneClient;
private PineconeIndexOperationClient controlPlaneClient;
private PineconeConnection connection;
private String namespace;
private VectorServiceGrpc.VectorServiceFutureStub futureStub;

@BeforeEach
public void setUp() {
Expand All @@ -37,30 +41,32 @@ public void setUp() {

controlPlaneClient = new PineconeIndexOperationClient(config);
dataPlaneClient = new PineconeClient(config);
namespace = RandomStringBuilder.build("ns", 8);

futureStub = connection.getFutureStub();
}

@Test
public void checkIndexSetup() throws Exception {
IndexMeta indexMeta = controlPlaneClient.describeIndex(indexName);
assertEquals(3, indexMeta.getDatabase().getDimension());
}

@Test
public void sanity() throws Exception {
IndexMeta indexMeta = controlPlaneClient.describeIndex(indexName);
String host = indexMeta.getStatus().getHost();
PineconeConnection connection = dataPlaneClient.connect(
connection = dataPlaneClient.connect(
new PineconeConnectionConfig()
.withConnectionUrl("https://" + host));
}

String namespace = RandomStringBuilder.build("ns", 8);

VectorServiceGrpc.VectorServiceFutureStub futureStub = connection.getFutureStub();
@Test
public void describeIndexStats() throws ExecutionException, InterruptedException {
DescribeIndexStatsRequest describeIndexRequest = DescribeIndexStatsRequest.newBuilder().build();
ListenableFuture<DescribeIndexStatsResponse> futureDescribeIndexResponse = futureStub.describeIndexStats(describeIndexRequest);

assertEquals(futureDescribeIndexResponse.get().getDimension(), 3);
}

@Test
public void sanity() throws Exception {
// upsert
float[][] upsertData = {{1.0F, 2.0F, 3.0F}, {4.0F, 5.0F, 6.0F}, {7.0F, 8.0F, 9.0F}};
List<String> upsertIds = Arrays.asList("v1", "v2", "v3");
Expand Down

0 comments on commit 447b28b

Please sign in to comment.