Skip to content

Commit

Permalink
Implement alter integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-asawicki committed Jan 23, 2024
1 parent 6934366 commit f664569
Showing 1 changed file with 45 additions and 2 deletions.
47 changes: 45 additions & 2 deletions pkg/sdk/testint/materialized_views_gen_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,54 @@ func TestInt_MaterializedViews(t *testing.T) {
})

t.Run("alter materialized view: recluster suspend and resume", func(t *testing.T) {
// TODO: fill me
request := createMaterializedViewBasicRequest(t).WithClusterBy(sdk.NewMaterializedViewClusterByRequest().WithExpressions([]sdk.MaterializedViewClusterByExpressionRequest{{"ID"}}))
view := createMaterializedViewWithRequest(t, request)
id := view.ID()

assert.Equal(t, true, view.AutomaticClustering)

alterRequest := sdk.NewAlterMaterializedViewRequest(id).WithSuspendRecluster(sdk.Bool(true))
err := client.MaterializedViews.Alter(ctx, alterRequest)
require.NoError(t, err)

alteredView, err := client.MaterializedViews.ShowByID(ctx, id)
require.NoError(t, err)

assert.Equal(t, false, alteredView.AutomaticClustering)

alterRequest = sdk.NewAlterMaterializedViewRequest(id).WithResumeRecluster(sdk.Bool(true))
err = client.MaterializedViews.Alter(ctx, alterRequest)
require.NoError(t, err)

alteredView, err = client.MaterializedViews.ShowByID(ctx, id)
require.NoError(t, err)

assert.Equal(t, true, alteredView.AutomaticClustering)
})

t.Run("alter materialized view: suspend and resume", func(t *testing.T) {
// TODO: fill me
view := createMaterializedView(t)
id := view.ID()

assert.Equal(t, false, view.Invalid)

alterRequest := sdk.NewAlterMaterializedViewRequest(id).WithSuspend(sdk.Bool(true))
err := client.MaterializedViews.Alter(ctx, alterRequest)
require.NoError(t, err)

alteredView, err := client.MaterializedViews.ShowByID(ctx, id)
require.NoError(t, err)

assert.Equal(t, true, alteredView.Invalid)

alterRequest = sdk.NewAlterMaterializedViewRequest(id).WithResume(sdk.Bool(true))
err = client.MaterializedViews.Alter(ctx, alterRequest)
require.NoError(t, err)

alteredView, err = client.MaterializedViews.ShowByID(ctx, id)
require.NoError(t, err)

assert.Equal(t, false, alteredView.Invalid)
})

t.Run("alter materialized view: set and unset values", func(t *testing.T) {
Expand Down

0 comments on commit f664569

Please sign in to comment.