Skip to content

Commit

Permalink
New setup, global RunSuites so no duplication, yay!
Browse files Browse the repository at this point in the history
  • Loading branch information
aulorbe committed Jul 26, 2024
1 parent cf5d0eb commit 517e8ed
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 16 deletions.
20 changes: 8 additions & 12 deletions pinecone/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ import (
"github.com/stretchr/testify/require"
)

func TestClientIntegration(t *testing.T) {
RunSuites(t)
}

// Integration tests:
func (ts *IntegrationTests) TestNewClientParamsSet() {
apiKey := "test-api-key"
Expand Down Expand Up @@ -307,7 +303,7 @@ func (ts *IntegrationTests) TestCreateServerlessIndex() {
}

func (ts *IntegrationTests) TestDescribeServerlessIndex() {
if ts.idxName == "" {
if ts.indexType == "pods" {
ts.T().Skip("No serverless index to test")
}
index, err := ts.client.DescribeIndex(context.Background(), ts.idxName)
Expand All @@ -322,7 +318,7 @@ func (ts *IntegrationTests) TestDescribeNonExistentIndex() {
}

func (ts *IntegrationTests) TestDescribeServerlessIndexSourceTag() {
if ts.idxName == "" {
if ts.indexType == "pods" {
ts.T().Skip("No serverless index to test")
}
index, err := ts.clientSourceTag.DescribeIndex(context.Background(), ts.idxName)
Expand All @@ -331,7 +327,7 @@ func (ts *IntegrationTests) TestDescribeServerlessIndexSourceTag() {
}

func (ts *IntegrationTests) TestDescribePodIndex() {
if ts.idxName == "" {
if ts.indexType == "serverless" {
ts.T().Skip("No pod index to test")
}
index, err := ts.client.DescribeIndex(context.Background(), ts.idxName)
Expand All @@ -340,7 +336,7 @@ func (ts *IntegrationTests) TestDescribePodIndex() {
}

func (ts *IntegrationTests) TestDescribePodIndexSourceTag() {
if ts.idxName == "" {
if ts.indexType == "serverless" {
ts.T().Skip("No pod index to test")
}
index, err := ts.clientSourceTag.DescribeIndex(context.Background(), ts.idxName)
Expand All @@ -349,7 +345,7 @@ func (ts *IntegrationTests) TestDescribePodIndexSourceTag() {
}

func (ts *IntegrationTests) TestListCollections() {
if ts.idxName == "" {
if ts.indexType == "serverless" {
ts.T().Skip("No pod index to test")
}
ctx := context.Background()
Expand Down Expand Up @@ -394,7 +390,7 @@ func (ts *IntegrationTests) TestListCollections() {
}

func (ts *IntegrationTests) TestDescribeCollection() {
if ts.idxName == "" {
if ts.indexType == "serverless" {
ts.T().Skip("No pod index to test")
}
ctx := context.Background()
Expand All @@ -417,7 +413,7 @@ func (ts *IntegrationTests) TestDescribeCollection() {
}

func (ts *IntegrationTests) TestCreateCollection() {
if ts.idxName == "" {
if ts.indexType == "serverless" {
ts.T().Skip("No pod index to test")
}
name := uuid.New().String()
Expand All @@ -437,7 +433,7 @@ func (ts *IntegrationTests) TestCreateCollection() {
}

func (ts *IntegrationTests) TestDeleteCollection() {
if ts.idxName == "" {
if ts.indexType == "serverless" {
ts.T().Skip("No pod index to test")
}
collectionName := uuid.New().String()
Expand Down
4 changes: 0 additions & 4 deletions pinecone/index_connection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ import (
"github.com/stretchr/testify/require"
)

func TestIndexConnectionIntegration(t *testing.T) {
RunSuites(t)
}

// Integration tests
func (ts *IntegrationTests) TestNewIndexConnection() {
apiKey := "test-api-key"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// This file is used to run all the test suites in the package pinecone
package pinecone

import (
Expand Down Expand Up @@ -50,3 +51,7 @@ func RunSuites(t *testing.T) {
suite.Run(t, serverlessTestSuite)

}

func TestRunSuites(t *testing.T) {
RunSuites(t)
}
File renamed without changes.

0 comments on commit 517e8ed

Please sign in to comment.