Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add integration tests for future stub #44

Closed
wants to merge 4 commits into from
Closed

Conversation

rohanshah18
Copy link
Contributor

@rohanshah18 rohanshah18 commented Nov 7, 2023

Problem

The sdk currently lacks integration tests for future stub which is used for data plane operations.

Solution

Added integration test for all data plane operations for future stub. As a part of this change, I have organized the integration test folder better by moving and renaming files:

  1. Moved ConfigureIndexTest.java:
    src/integration/java/io/pinecone/integration/ConfigureIndexTest.java -> src/integration/java/io/pinecone/ControlPlane/ConfigureIndexTest.java
  2. Renamed PineconeIndexOperationsClientIntegrationTest.java to CreateAndDeleteIndexTest.java and moved it from: src/integration/java/io/pinecone/PineconeIndexOperationsClientIntegrationTest.java -> src/integration/java/io/pinecone/ControlPlane/CreateAndDeleteIndexTest.java
  3. Renamed PineconeClientLiveIntegTest.java to SyncStubTest.java and moved it from:
    src/integration/java/io/pinecone/PineconeClientLiveIntegTest.java ->
    src/integration/java/io/pinecone/DataPlane/SyncStubTest.java

I have also updated some weird assert calls with the correct assert functionality in SyncStubTest.java so the only files to review are:

  1. AsyncStubTest.java
  2. SyncStubTest.java

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Infrastructure change (CI configs, etc)
  • Non-code change (docs, etc)
  • None of the above: (explain here)

Test Plan

Ran integration tests.

@rohanshah18 rohanshah18 marked this pull request as ready for review November 7, 2023 03:26
Copy link
Contributor

@jhamon jhamon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really think we should split up this integration test into many smaller and more focused tests.

@@ -20,7 +20,7 @@
public class ConfigureIndexTest {
private PineconeIndexOperationClient pinecone;
private String indexName;
private static final Logger logger = LoggerFactory.getLogger(PineconeClientLiveIntegTest.class);
private static final Logger logger = LoggerFactory.getLogger(SyncStubTest.class);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be ConfigureIndexTest.class?

}

@Test
public void sanity() throws Exception {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this test is doing way too much. When a test like this fails, it takes a lot of investigation to figure out what is actually breaking.

Some operations (e.g. create & describe/list, upsert & fetch, upsert & query) make sense to use and test together, but you could still break this down into many smaller test cases.

I would have test cases for:

  • Create index (with minimal params) and describe index
  • Create index (passing all optional params) and describe index
  • Upsert and fetch
  • Upsert hybrid and fetch
  • Upsert and fetch by id
  • Upsert and query by id
  • Upsert and query with vector values
    • with includeMetadata
    • with includeValues
  • Upsert hybrid and query
  • Edge cases (missing params, invalid names, wrong vector dimension, etc)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great, thank you for providing me with this list. It has been like this since I picked up and always thought it was okay haha.

@@ -185,7 +187,7 @@ public void sanity() throws Exception {
conn.getBlockingStub().delete(deleteRequest);
fetchRequest = FetchRequest.newBuilder().addAllIds(ids).setNamespace(namespace).build();
fetchResponse = conn.getBlockingStub().fetch(fetchRequest);
assert (fetchResponse.getVectorsCount() == ids.size() - 1);
assertEquals (fetchResponse.getVectorsCount(), ids.size() - 1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
assertEquals (fetchResponse.getVectorsCount(), ids.size() - 1);
assertEquals(fetchResponse.getVectorsCount(), ids.size() - 1);

@rohanshah18 rohanshah18 deleted the rshah/addIntegTests branch July 10, 2024 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants