pinecone-io / go-pinecone

Pinecone.io Golang Client
Apache License 2.0
49 stars 9 forks source link

Refactor sparse vector integration tests #72

Closed austin-denoble closed 2 months ago

austin-denoble commented 2 months ago

Problem

We had a ticket logged for making sure that we covered working with sparse vectors in integration tests.

Solution

I realized we were already creating sparse vectors whenever we called createVectorsForUpsert, but the function was a bit unwieldy to work with.

I refactored things into a new helper func GenerateVectors(numOfVectors int, dimension int32, isSparse bool) []*Vector. This is a bit more flexible.

I also cleaned up how we were handling the IntegrationTest.vectorIds field on the test struct. I wanted to make sure we were consistently adding to and deleting from this collection across tests.

Type of Change

Test Plan

Existing integration tests should pass.