Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Pinecone Local testing support in CI (#77)
## Problem We want to add CI that validates testing the Go SDK against an instance of pclocal hosted in a Docker container. ## Solution - Update the `ci.yaml` GitHub workflow file to add a new `services` block, which includes using the `ghcr.io/pinecone-io/pinecone-index:latest` Docker image to create and how two indexes locally (pods and serverless). - Add new `/pinecone/local_test.go` which defines a new `LocalIntegrationTests` 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. - Add a new `Run local integration tests` step to the `ci.yaml` workflow. This triggers the new `local-test.go` file which tests both instances of locally hosted indexes (`PINECONE_INDEX_URL_POD`, `PINECONE_INDEX_URL_SERVERLESS`) with `go 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: - Metadata filtering - Sparse vectors - Multiple namespaces - List vectors ## 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 - [X] Infrastructure change (CI configs, etc) - [ ] Non-code change (docs, etc) - [ ] None of the above: (explain here) ## 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: ```bash export PINECONE_INDEX_URL_POD="http://localhost:5082" PINECONE_INDEX_URL_SERVERLESS="http://localhost:5081" PINECONE_DIMENSION="1536" ``` Then, you can run the local integration tests directly: ```bash go test -count=1 -v ./pinecone -run TestRunLocalIntegrationSuite -tags=localServer ``` --- - To see the specific tasks where the Asana app for GitHub is being used, see below: - https://app.asana.com/0/0/1208056331944375
- Loading branch information