-
Notifications
You must be signed in to change notification settings - Fork 13
Refactor CollectionTest
, ConfigureIndexTest
, and IndexManager
to improve integration test speed and reliability
#81
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
Refactor CollectionTest
, ConfigureIndexTest
, and IndexManager
to improve integration test speed and reliability
#81
Conversation
… move to using waitUntilIndexReady over isIndexReady
… error tests into the CollectionTest file
… to ease server flakiness
47513a6
to
5e1fef3
Compare
…grationTest command in pr workflow
…ittle clean up in CollectionTest
…yncIndex architecture
…ction tests to wait less time and not wait at all in certain cases
src/integration/java/io/pinecone/integration/controlPlane/pod/ConfigureIndexTest.java
Show resolved
Hide resolved
src/integration/java/io/pinecone/integration/controlPlane/pod/ConfigureIndexTest.java
Show resolved
Hide resolved
src/integration/java/io/pinecone/integration/dataPlane/UpsertAndQueryPodTest.java
Show resolved
Hide resolved
src/integration/java/io/pinecone/integration/dataPlane/UpsertAndQueryServerlessTest.java
Show resolved
Hide resolved
src/integration/java/io/pinecone/integration/dataPlane/UpsertAndQueryServerlessTest.java
Show resolved
Hide resolved
CollectionTest
, ConfigureIndexTest
, and IndexManager
to improve integration test speed and reliability
src/integration/java/io/pinecone/integration/controlPlane/pod/ConfigureIndexTest.java
Outdated
Show resolved
Hide resolved
src/integration/java/io/pinecone/integration/controlPlane/pod/CollectionTest.java
Outdated
Show resolved
Hide resolved
src/integration/java/io/pinecone/integration/dataPlane/QueryErrorPodTest.java
Show resolved
Hide resolved
src/integration/java/io/pinecone/integration/dataPlane/QueryErrorPodTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general these changes look good and should improve the reliability and speed of the test runs.
I added some various test structure comments throughout
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for going through all of the changes. Looks like the collections tests are still failing. Also updating the CI to output more logs will add more noise and its not easily clear what tests are failing. I think having the short summary of what assertions failed with line numbers is cleaner and we can reproduce them locally but if this is helpful to you, we can keep add more info temporarily.
src/integration/java/io/pinecone/integration/dataPlane/UpsertAndQueryPodTest.java
Show resolved
Hide resolved
I left a comment about this, but I don't think running locally is a substitute for debugging what is happening in CI. We should be able to look at the CI logs, and have a somewhat clear idea what the issue is. You can pretty easily search through the logs for |
Problem
We've had continued issues with flakiness of integration tests, and tests taking a while to run (25 - 30 minutes for the entire
pr
workflow in some cases). A lot of this is waiting for indexes and collections to beReady
instead ofInitializing
. Specifically, theCollectionTest
andCollectionErrorTest
can take a really long time due to setting up and waiting on multiple indexes and collections.While working on the above issue, I also noticed test failures and repeated issues due to
findIndexWithDimensionAndType
, and tests running with indexes created by and belonging to other test runs. TheisIndexReady
function also tends to be inefficient as the polling isn't consistent, and we can end up waiting sometimes minutes longer than we may need to.With the new
Pinecone
andIndex
/AsyncIndex
class structure in place, we can refactor our integration tests around the new pattern.Solution
Ultimately, I would like to move our tests away from the
createIndexIfNotExistsDataPlane
/createIndexIfNotExistsControlPlane
functions and their reliance on thefindIndexWithDimensionAndType
function, which should be deprecated. We should come up with a pattern for sharing resources across all tests in a run, and setting up / tearing those down once. This can be worked on in subsequent PRs.CollectionErrorTests
tests intoCollectionTest
. Share index and collection setup@BeforeAll
across collections tests. Wait less time for the indexes created from the collection to be ready as this specifically can take a number of minutes. Relax some of the assertions on thestatus
of created collections and indexes as I don't think we need to be that thorough here.createIndexIfNotExistsDataPlane
to return a tuple (AbstractMap.SimpleEntry<String, Pinecone>
) of theindexName
and thePinecone
client to make things a bit easier to work with.dataPlane/
tests to usepineconeClient.createIndexConnection()
andpineconeClient.createAsyncIndexConnection()
for managing data plane operations.isIndexReady
in lieu ofwaitUntilIndexIsReady
. The polling is more consistent with this function, and it most likely saves us time overall.ConfigureIndexTest
to create its own index and clean up after.findIndexByDimensionAndType
callingisIndexReady()
on each index while iterating through the list.IndexInterface.validateUpsertRequest
where we were trying to callsparseValuesWithUnsignedIndices.getIndicesWithUnsigned32IntList()
andsparseValuesWithUnsignedIndices.getValuesList()
on a possiblenull
causing aNullPointerException
.try
/catch
yourself unless you need to assert on the result. We should be letting errors throw to the test runner and let it handle them so we're not clobbering logs and stack traces. I've cleaned uptry
/catch
statements which don't seem to be needed.gradle integrationTest --info
inpr.yml
to get more detailed log output in the console for better troubleshooting of ongoing flapping.assertWithRetry
wrappers for specific actions which have been troublesome. AddingThread.sleep()
to a few places to avoid hammering an index too quickly / etc.describeIndexStats()
overload toIndexInterface
andIndex
/AsyncIndex
to allow calling without needing to explicitly passnull
.I spent a lot of time running these locally and in CI to see how they perform. Overall, it seems like these changes improve overall reliability, although we still do see a few failures like the gRPC
no healthy upstream
on data plane operations with fresh indexes.The total amount of time it takes to run both sets of integration tests has been cut significantly in most cases:
Next steps would be to create a Junit extension and possible
IndexManagerSingleton
to manage index resources across all tests directly. This would help make things more predictable and reliable when adding future tests. This would also allow us to handle concurrent integration test runs under the same API key, which is currently very difficult due tofindIndexByDimensionAndType
.Type of Change
Test Plan
Run integration tests and compare over run length and