Skip to content

Commit

Permalink
Fix streamlits grants test and add a note about missing grant
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-jmichalak committed Feb 10, 2025
1 parent 4b7b552 commit e86b3c9
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
3 changes: 3 additions & 0 deletions docs/resources/grant_privileges_to_account_role.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ description: |-

~> **Note** When granting privileges on applications (for example, the default "SNOWFLAKE" application) use `on_account_object.object_type = "DATABASE"` instead.

<!-- TODO(SNOW-1844996): Remove this note.-->
-> **Note** Granting on future Streamlits is currently missing. It will be added in the future. Use [execute](./execute) resource instead.

# snowflake_grant_privileges_to_account_role (Resource)


Expand Down
3 changes: 3 additions & 0 deletions docs/resources/grant_privileges_to_database_role.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ description: |-

~> **Note** Manage grants on `HYBRID TABLE` by specifying `TABLE` or `TABLES` in `object_type` field. This applies to a single object, all objects, or future objects. This reflects the current behavior in Snowflake.

<!-- TODO(SNOW-1844996): Remove this note.-->
-> **Note** Granting on future Streamlits is currently missing. It will be added in the future. Use [execute](./execute) resource instead.

# snowflake_grant_privileges_to_database_role (Resource)


Expand Down
8 changes: 2 additions & 6 deletions pkg/sdk/testint/streamlits_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ func TestInt_Streamlits(t *testing.T) {
require.ErrorContains(t, err, fmt.Sprintf("The specified warehouse %s does not exist", strings.ToUpper(warehouse.ID().Name())))
})

// TODO [SNOW-1272222]: fix the test when it starts working on Snowflake side
t.Run("grant privilege to streamlits to role", func(t *testing.T) {
stage, cleanupStage := testClientHelper().Stage.CreateStage(t)
t.Cleanup(cleanupStage)
Expand Down Expand Up @@ -140,8 +139,7 @@ func TestInt_Streamlits(t *testing.T) {
},
}
err = client.Grants.GrantPrivilegesToAccountRole(ctx, privileges, on, role.ID(), nil)
require.Error(t, err)
require.ErrorContains(t, err, "Unsupported feature 'STREAMLIT'")
require.NoError(t, err)

on = &sdk.AccountRoleGrantOn{
SchemaObject: &sdk.GrantOnSchemaObject{
Expand All @@ -155,7 +153,6 @@ func TestInt_Streamlits(t *testing.T) {
require.NoError(t, err)
})

// TODO [SNOW-1272222]: fix the test when it starts working on Snowflake side
t.Run("grant privilege to streamlits to database role", func(t *testing.T) {
stage, cleanupStage := testClientHelper().Stage.CreateStage(t)
t.Cleanup(cleanupStage)
Expand Down Expand Up @@ -207,8 +204,7 @@ func TestInt_Streamlits(t *testing.T) {
},
}
err = client.Grants.GrantPrivilegesToDatabaseRole(ctx, privileges, on, databaseRoleId, nil)
require.Error(t, err)
require.ErrorContains(t, err, "Unsupported feature 'STREAMLIT'")
require.NoError(t, err)

on = &sdk.DatabaseRoleGrantOn{
SchemaObject: &sdk.GrantOnSchemaObject{
Expand Down
3 changes: 3 additions & 0 deletions templates/resources/grant_privileges_to_account_role.md.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ description: |-

~> **Note** When granting privileges on applications (for example, the default "SNOWFLAKE" application) use `on_account_object.object_type = "DATABASE"` instead.

<!-- TODO(SNOW-1844996): Remove this note.-->
-> **Note** Granting on future Streamlits is currently missing. It will be added in the future. Use [execute](./execute) resource instead.

# {{.Name}} ({{.Type}})

{{ .Description | trimspace }}
Expand Down
3 changes: 3 additions & 0 deletions templates/resources/grant_privileges_to_database_role.md.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ description: |-

~> **Note** Manage grants on `HYBRID TABLE` by specifying `TABLE` or `TABLES` in `object_type` field. This applies to a single object, all objects, or future objects. This reflects the current behavior in Snowflake.

<!-- TODO(SNOW-1844996): Remove this note.-->
-> **Note** Granting on future Streamlits is currently missing. It will be added in the future. Use [execute](./execute) resource instead.

# {{.Name}} ({{.Type}})

{{ .Description | trimspace }}
Expand Down

0 comments on commit e86b3c9

Please sign in to comment.