Skip to content

Commit

Permalink
changes after review
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-jcieslak committed Jan 8, 2024
1 parent f935612 commit c1633d9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,8 @@ func TestAcc_GrantPrivilegesToDatabaseRole_OnFutureSchemasInDatabase(t *testing.
resource.TestCheckResourceAttr(resourceName, "privileges.0", string(sdk.SchemaPrivilegeCreateTable)),
resource.TestCheckResourceAttr(resourceName, "privileges.1", string(sdk.SchemaPrivilegeModify)),
resource.TestCheckResourceAttr(resourceName, "on_schema.#", "1"),
resource.TestCheckResourceAttr(resourceName, "on_schema.0.future_schemas_in_database", databaseName), resource.TestCheckResourceAttr(resourceName, "with_grant_option", "false"),
resource.TestCheckResourceAttr(resourceName, "on_schema.0.future_schemas_in_database", databaseName),
resource.TestCheckResourceAttr(resourceName, "with_grant_option", "false"),
resource.TestCheckResourceAttr(resourceName, "id", fmt.Sprintf("%s|false|false|CREATE TABLE,MODIFY|OnSchema|OnFutureSchemasInDatabase|%s", databaseRoleName, databaseName)),
),
},
Expand Down
2 changes: 2 additions & 0 deletions pkg/resources/grant_privileges_to_database_role_identifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ func ParseGrantPrivilegesToDatabaseRoleId(id string) (GrantPrivilegesToDatabaseR
return databaseRoleId, sdk.NewError(`database role identifier should hold at least 5 parts "<database_role_name>|<with_grant_option>|<always_apply>|<privileges>|<grant_type>|<grant_data>"`)
}

// TODO: Identifier parsing should be replaced with better version introduced in SNOW-999049.
// Right now, it's same as sdk.NewDatabaseObjectIdentifierFromFullyQualifiedName, but with error handling.
databaseRoleNameParts := strings.Split(parts[0], ".")
if len(databaseRoleNameParts) == 0 ||
(len(databaseRoleNameParts) == 1 && databaseRoleNameParts[0] == "") ||
Expand Down
17 changes: 0 additions & 17 deletions pkg/sdk/parameters_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package sdk

import (
"log"
"testing"
)

Expand All @@ -23,19 +22,3 @@ func TestSetObjectParameterOnObject(t *testing.T) {
assertOptsValidAndSQLEquals(t, opts, "ALTER USER %s SET ENABLE_UNREDACTED_QUERY_SYNTAX_ERROR = TRUE", id.FullyQualifiedName())
})
}

func (o ObjectType) Check() bool {
var m map[ObjectType]bool
if _, ok := m[o]; ok {
return true
}
return false
}

func Test(t *testing.T) {
a := "abc"
b := ObjectTypeDatabase

log.Println(ObjectType(a).Check())
log.Println(b.Check())
}

0 comments on commit c1633d9

Please sign in to comment.