Skip to content

Commit

Permalink
Save work
Browse files Browse the repository at this point in the history
  • Loading branch information
aulorbe committed Jul 19, 2024
1 parent a3127fa commit fbe03b0
Show file tree
Hide file tree
Showing 2 changed files with 312 additions and 88 deletions.
29 changes: 25 additions & 4 deletions pinecone/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,23 @@ func (ts *ClientTestsIntegration) TestCreatePodIndexInvalidDimension() {
require.Equal(ts.T(), reflect.TypeOf(err), reflect.TypeOf(&PineconeError{}), "Expected error to be of type PineconeError")
}

func (ts *ClientTestsIntegration) TestCreatePodIndexFromCollection() {
name := uuid.New().String()

defer func(ts *ClientTestsIntegration, name string) {
err := ts.deleteCollection(name)
require.NoError(ts.T(), err)
}(ts, name)

collection, err := ts.client.CreateCollection(context.Background(), &CreateCollectionRequest{
Name: name,
Source: ts.podIndex,
})
require.NoError(ts.T(), err)

assert.Equal(ts.T(), collection.Name, name)
}

func (ts *ClientTestsIntegration) TestCreateServerlessIndexInvalidDimension() {
name := uuid.New().String()

Expand Down Expand Up @@ -582,10 +599,6 @@ func (ts *ClientTestsIntegration) TestConfigureIndexHitPodLimit() {
require.ErrorContainsf(ts.T(), err, "You've reached the max pods allowed", err.Error())
}

func (ts *ClientTestsIntegration) deleteIndex(name string) error {
return ts.client.DeleteIndex(context.Background(), name)
}

func (ts *ClientTestsIntegration) TestExtractAuthHeader() {
globalApiKey := os.Getenv("PINECONE_API_KEY")
os.Unsetenv("PINECONE_API_KEY")
Expand Down Expand Up @@ -1283,3 +1296,11 @@ func mockResponse(body string, statusCode int) *http.Response {
Header: make(http.Header),
}
}

func (ts *ClientTestsIntegration) deleteIndex(name string) error {
return ts.client.DeleteIndex(context.Background(), name)
}

func (ts *ClientTestsIntegration) deleteCollection(name string) error {
return ts.client.DeleteCollection(context.Background(), name)
}
Loading

0 comments on commit fbe03b0

Please sign in to comment.