-
Notifications
You must be signed in to change notification settings - Fork 9
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 Pinecone Local testing support in CI #77
Conversation
@@ -17,6 +36,13 @@ jobs: | |||
run: | | |||
go get ./pinecone | |||
- name: Run tests | |||
continue-on-error: true |
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.
We still want to run the subsequent step that specifically runs local integration tests.
@@ -0,0 +1,154 @@ | |||
//go:build localServer |
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.
Isolating these tests from the other tests. I think this works for not running these tests as a part of the unit / integration test suite, but there may be a better way to do this in Go.
@@ -54,7 +54,6 @@ func (ts *IntegrationTests) SetupSuite() { | |||
for i, v := range vectors { | |||
vectorIds[i] = v.Id | |||
} | |||
ts.vectorIds = append(ts.vectorIds, vectorIds...) |
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.
This was being done twice. I think it's better to keep the actual appending where we upsert successfully. It's inside the upsertVectors
helper function.
…docker image, add new local_test.go harness for handling specific testing scenarios
…tep fails, pass the service name and port rather than localhost as environment variables
34048a3
to
165e7f4
Compare
…index and namespace combinations, make sure we're using sparse vectors and attaching metadata, cover more deletion cases when the suite cleans up
… amount we were previously checking for because of multiple namespaces
…ctorsResponse, only run test for list vectors when the test suite is for serverless, update serverless pclocal to dot-product in github ci
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.
👍
This is a good setup. It'll be great if we can eventually eliminate some of the integration testing against prod db.
pinecone/index_connection.go
Outdated
var usage *Usage | ||
if res.Usage != nil { | ||
usage = &Usage{ReadUnits: derefOrDefault(res.Usage.ReadUnits, 0)} | ||
} else { | ||
usage = nil | ||
} | ||
|
||
return &ListVectorsResponse{ | ||
VectorIds: vectorIds, | ||
Usage: &Usage{ReadUnits: derefOrDefault(res.Usage.ReadUnits, 0)}, | ||
Usage: usage, |
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.
good catch
Problem
We want to add CI that validates testing the Go SDK against an instance of pclocal hosted in a Docker container.
Solution
ci.yaml
GitHub workflow file to add a newservices
block, which includes using theghcr.io/pinecone-io/pinecone-index:latest
Docker image to create and how two indexes locally (pods and serverless)./pinecone/local_test.go
which defines a newLocalIntegrationTests
struct, which isolates a collection of tests specifically meant for pclocal. The tests are isolated from our unit + integration test suite with the//go:build localServer
build tag. Two suites are defined for pods and serverless, and each set of tests is run against both indexes. For now the test suite generates 100 vectors, upserts them to the index, tests basic Fetch, Query, Update, DescribeIndexStats, and Delete.Run local integration tests
step to theci.yaml
workflow. This triggers the newlocal-test.go
file which tests both instances of locally hosted indexes (PINECONE_INDEX_URL_POD
,PINECONE_INDEX_URL_SERVERLESS
) withgo test -count=1 -v ./pinecone -run TestRunLocalIntegrationSuite -tags=localServer
.To Do
I'd like to expand the number of different tests we exercise on each index. Specifically:
Type of Change
Test Plan
Make sure the CI workflow passes for this PR.
If you'd like to run the local integration tests locally, you will need to download Docker, and use
docker compose up
to create the same indexes on your local machine. Once you've done that, you'll need to export environment variables for the different index addresses, along with the dimension.Here's an example:
Then, you can run the local integration tests directly:
go test -count=1 -v ./pinecone -run TestRunLocalIntegrationSuite -tags=localServer