Skip to content

Commit

Permalink
redo sleeps zzz
Browse files Browse the repository at this point in the history
  • Loading branch information
austin-denoble committed Aug 22, 2024
1 parent 7540353 commit fb223ea
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
16 changes: 1 addition & 15 deletions pinecone/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"reflect"
"strings"
"testing"
"time"

"github.com/google/go-cmp/cmp"
"github.com/pinecone-io/go-pinecone/internal/gen"
Expand Down Expand Up @@ -166,9 +165,6 @@ func (ts *IntegrationTests) TestDeletionProtection() {
_, err = ts.client.ConfigureIndex(context.Background(), ts.idxName, ConfigureIndexParams{DeletionProtection: "disabled"})
require.NoError(ts.T(), err)

// allow time for the index to start upgrading
time.Sleep(5 * time.Second)

// Before moving on to another test, wait for the index to be done upgrading
_, err = WaitUntilIndexReady(ts, context.Background())
require.NoError(ts.T(), err)
Expand Down Expand Up @@ -219,9 +215,6 @@ func (ts *IntegrationTests) TestConfigureIndexScaleUpNoPods() {
_, err = ts.client.ConfigureIndex(context.Background(), name, ConfigureIndexParams{Replicas: 2})
require.NoError(ts.T(), err)

// allow time for the index to start upgrading
time.Sleep(5 * time.Second)

// Before moving on to another test, wait for the index to be done upgrading
_, err = WaitUntilIndexReady(ts, context.Background())
require.NoError(ts.T(), err)
Expand Down Expand Up @@ -249,9 +242,6 @@ func (ts *IntegrationTests) TestConfigureIndexScaleUpNoReplicas() {
_, err = ts.client.ConfigureIndex(context.Background(), name, ConfigureIndexParams{PodType: "p1.x4"})
require.NoError(ts.T(), err)

// allow time for the index to start upgrading
time.Sleep(5 * time.Second)

// Before moving on to another test, wait for the index to be done upgrading
_, err = WaitUntilIndexReady(ts, context.Background())
require.NoError(ts.T(), err)
Expand Down Expand Up @@ -1209,8 +1199,6 @@ func TestBuildClientBaseOptionsUnit(t *testing.T) {

// Helper functions:
func (ts *IntegrationTests) deleteIndex(name string) error {
time.Sleep(5 * time.Second)

_, err := WaitUntilIndexReady(ts, context.Background())
require.NoError(ts.T(), err)

Expand All @@ -1219,9 +1207,7 @@ func (ts *IntegrationTests) deleteIndex(name string) error {
fmt.Printf("<<< TRYING TO DELETE INDEX >>> : %+v", index)
fmt.Printf("<<< STATE >>> : %+v\n", index.Status)

err = ts.client.DeleteIndex(context.Background(), name)
require.NoError(ts.T(), err)
return nil
return ts.client.DeleteIndex(context.Background(), name)
}

func mockResponse(body string, statusCode int) *http.Response {
Expand Down
1 change: 1 addition & 0 deletions pinecone/test_suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ func WaitUntilIndexReady(ts *IntegrationTests, ctx context.Context) (bool, error
maxRetries := 24
delay := 5 * time.Second
totalSeconds := 0
time.Sleep(2 * time.Second)

for i := 0; i < maxRetries; i++ {
index, err := ts.client.DescribeIndex(ctx, ts.idxName)
Expand Down

0 comments on commit fb223ea

Please sign in to comment.