Skip to content

Commit

Permalink
version 0.20.1 (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
pmenglund authored Aug 18, 2023
1 parent 207136f commit 2cae2be
Show file tree
Hide file tree
Showing 48 changed files with 131 additions and 54 deletions.
2 changes: 1 addition & 1 deletion openapi/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion openapi/configuration.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Binary file not shown.
Binary file modified vcr/CollectionTestSuite/TestGetCollection.cassette.gz
Binary file not shown.
Binary file modified vcr/CollectionTestSuite/TestListAllCollections.cassette.gz
Binary file not shown.
Binary file not shown.
Binary file modified vcr/CollectionTestSuite/TestUpdateCollection.cassette.gz
Binary file not shown.
Binary file modified vcr/IntegrationTestSuite/TestCreateGCSIntegration.cassette.gz
Binary file not shown.
Binary file modified vcr/IntegrationTestSuite/TestCreateS3Integration.cassette.gz
Binary file not shown.
Binary file modified vcr/IntegrationTestSuite/TestGetIntegration.cassette.gz
Binary file not shown.
Binary file modified vcr/IntegrationTestSuite/TestListIntegrations.cassette.gz
Binary file not shown.
Binary file modified vcr/QueryIntegrationSuite/TestAsyncQuery.cassette.gz
Binary file not shown.
Binary file not shown.
Binary file modified vcr/QueryIntegrationSuite/TestCancelQuery.cassette.gz
Binary file not shown.
Binary file modified vcr/QueryIntegrationSuite/TestListQueries.cassette.gz
Binary file not shown.
Binary file modified vcr/QueryIntegrationSuite/TestQuery.cassette.gz
Binary file not shown.
Binary file modified vcr/QueryIntegrationSuite/TestQueryWithTimeout.cassette.gz
Binary file not shown.
Binary file modified vcr/QueryIntegrationSuite/TestValidateQuery.cassette.gz
Binary file not shown.
Binary file modified vcr/TestAliasIntegrationSuite.cassette.gz
Binary file not shown.
Binary file modified vcr/TestAzureIntegrations.cassette.gz
Binary file not shown.
Binary file modified vcr/TestCollectionIntegrationSuite.cassette.gz
Binary file not shown.
Binary file modified vcr/TestDocumentSuite.cassette.gz
Binary file not shown.
Binary file modified vcr/TestError_IsNotFoundError.cassette.gz
Binary file not shown.
Binary file modified vcr/TestListViews.cassette.gz
Binary file not shown.
Binary file modified vcr/TestRockClient_CreateQueryLambda.cassette.gz
Binary file not shown.
Binary file modified vcr/TestRockClient_GetOrganization.cassette.gz
Binary file not shown.
Binary file modified vcr/TestRockClient_GetQueryLambdaVersion.cassette.gz
Binary file not shown.
Binary file modified vcr/TestRockClient_GetQueryLambdaVersionByTag.cassette.gz
Binary file not shown.
Binary file modified vcr/TestRockClient_ListQueryLambdaTags.cassette.gz
Binary file not shown.
Binary file modified vcr/TestRockClient_ListQueryLambdaVersions.cassette.gz
Binary file not shown.
Binary file modified vcr/TestRockClient_ListQueryLambdas.cassette.gz
Binary file not shown.
Binary file modified vcr/TestRockClient_ListQueryLambdas_workspace.cassette.gz
Binary file not shown.
Binary file modified vcr/TestRockClient_Ping.cassette.gz
Binary file not shown.
Binary file modified vcr/TestRockClient_withAPIServerEnv.cassette.gz
Binary file not shown.
Binary file modified vcr/TestRoleIntegration.cassette.gz
Binary file not shown.
Binary file modified vcr/TestSuiteAPIKey.cassette.gz
Binary file not shown.
Binary file modified vcr/TestSuiteWorkspace.cassette.gz
Binary file not shown.
Binary file modified vcr/TestTemplate.cassette.gz
Binary file not shown.
Binary file modified vcr/TestUserIntegration.cassette.gz
Binary file not shown.
Binary file modified vcr/TestViewCRUD.cassette.gz
Binary file not shown.
Binary file modified vcr/TestVirtualInstance.cassette.gz
Binary file not shown.
Binary file modified vcr/TestVirtualInstanceIntegration.cassette.gz
Binary file not shown.
Binary file modified vcr/example_s3.cassette.gz
Binary file not shown.
96 changes: 96 additions & 0 deletions vcr/example_vcr.cassette

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion version.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package rockset

// Version is the Rockset client version
const Version = "0.20.0"
const Version = "0.20.1"
71 changes: 22 additions & 49 deletions wait.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,64 +63,36 @@ func (rc *RockClient) WaitUntilAliasGone(ctx context.Context, workspace, alias s
// WaitUntilQueryCompleted waits until queryID has either completed, errored, or been cancelled.
func (rc *RockClient) WaitUntilQueryCompleted(ctx context.Context, queryID string) error {
// TODO should this only wait for COMPLETED and return an error for ERROR and CANCELLED?
return rc.RetryWithCheck(ctx, resourceHasState(ctx, []QueryState{QueryCompleted, QueryError, QueryCancelled}, func(ctx context.Context) (QueryState, error) {
q, err := rc.GetQueryInfo(ctx, queryID)
return QueryState(q.GetStatus()), err
}))
return rc.RetryWithCheck(ctx, resourceHasState(ctx, []QueryState{QueryCompleted, QueryError, QueryCancelled},
func(ctx context.Context) (QueryState, error) {
q, err := rc.GetQueryInfo(ctx, queryID)
return QueryState(q.GetStatus()), err
}))
}

// WaitUntilCollectionReady waits until the collection is ready.
func (rc *RockClient) WaitUntilCollectionReady(ctx context.Context, workspace, name string) error {
return rc.RetryWithCheck(ctx, resourceHasState(ctx, []string{collectionStatusREADY}, func(ctx context.Context) (string, error) {
c, err := rc.GetCollection(ctx, workspace, name)
return c.GetStatus(), err
}))
}

// WaitUntilCollectionIsQueryable waits until it is possible to query the collection. It first
// waits until the collection is READY before waiting for it to be queryable.
func (rc *RockClient) WaitUntilCollectionIsQueryable(ctx context.Context, workspace, collection string) error {
// first make sure the workspace and collection are valid, to avoid SQL injection
if err := ValidEntityName(workspace); err != nil {
return err
}
if err := ValidEntityName(collection); err != nil {
return err
}

// wait for it to be READY, so we know that any 404 we get from thm API server is due to eventual consistency
if err := rc.WaitUntilCollectionReady(ctx, workspace, collection); err != nil {
return err
}
// now wait for a query to succeed
return rc.RetryWithCheck(ctx, func() (retry bool, err error) {
// we don't care about the result, just that we can query
_, err = rc.Query(ctx, fmt.Sprintf("SELECT * FROM %s.%s LIMIT 1", workspace, collection))

var re Error
if errors.As(err, &re) {
if re.IsNotFoundError() {
// the resource is not present, but we want to retry anyway as it *should* be present
return true, nil
}
}

return false, err
})
return rc.RetryWithCheck(ctx, resourceHasState(ctx, []string{collectionStatusREADY},
func(ctx context.Context) (string, error) {
c, err := rc.GetCollection(ctx, workspace, name)
return c.GetStatus(), err
}))
}

func (rc *RockClient) WaitUntilVirtualInstanceActive(ctx context.Context, id string) error {
return rc.RetryWithCheck(ctx, resourceHasState(ctx, []string{VirtualInstanceActive}, func(ctx context.Context) (string, error) {
vi, err := rc.GetVirtualInstance(ctx, id)
return vi.GetState(), err
}))
return rc.RetryWithCheck(ctx, resourceHasState(ctx, []string{VirtualInstanceActive},
func(ctx context.Context) (string, error) {
vi, err := rc.GetVirtualInstance(ctx, id)
return vi.GetState(), err
}))
}

func (rc *RockClient) WaitUntilVirtualInstanceSuspended(ctx context.Context, id string) error {
return rc.RetryWithCheck(ctx, resourceHasState(ctx, []string{VirtualInstanceSuspended}, func(ctx context.Context) (string, error) {
vi, err := rc.GetVirtualInstance(ctx, id)
return vi.GetState(), err
}))
return rc.RetryWithCheck(ctx, resourceHasState(ctx, []string{VirtualInstanceSuspended},
func(ctx context.Context) (string, error) {
vi, err := rc.GetVirtualInstance(ctx, id)
return vi.GetState(), err
}))
}

// WaitUntilCollectionGone waits until a collection marked for deletion is gone, i.e. GetCollection()
Expand Down Expand Up @@ -159,7 +131,8 @@ func (rc *RockClient) WaitUntilWorkspaceGone(ctx context.Context, workspace stri

// WaitUntilCollectionHasNewDocuments waits until the collection has at least count new documents
// (measured from when the method is called).
func (rc *RockClient) WaitUntilCollectionHasNewDocuments(ctx context.Context, workspace, name string, count int64) error {
func (rc *RockClient) WaitUntilCollectionHasNewDocuments(ctx context.Context, workspace, name string,
count int64) error {
waiter := docWaiter{rc: rc}
return rc.RetryWithCheck(ctx, waiter.collectionHasNewDocs(ctx, workspace, name, count))
}
Expand Down
12 changes: 10 additions & 2 deletions wait_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ func (s *WaitTestSuite) TestResourceIsAvailable() {

switch counter {
case 0:
return Error{ErrorModel: &openapi.ErrorModel{}, StatusCode: http.StatusNotFound, Cause: fmt.Errorf("resource not present")}
return Error{
ErrorModel: &openapi.ErrorModel{},
StatusCode: http.StatusNotFound,
Cause: fmt.Errorf("resource not present"),
}
case 1:
return nil
default:
Expand Down Expand Up @@ -61,7 +65,11 @@ func (s *WaitTestSuite) TestResourceIsGone() {
case 0:
return nil
case 1:
return Error{ErrorModel: &openapi.ErrorModel{}, StatusCode: http.StatusNotFound, Cause: fmt.Errorf("resource not present")}
return Error{
ErrorModel: &openapi.ErrorModel{},
StatusCode: http.StatusNotFound,
Cause: fmt.Errorf("resource not present"),
}
default:
return fmt.Errorf("fail")
}
Expand Down

0 comments on commit 2cae2be

Please sign in to comment.