Skip to content

Commit

Permalink
Uncomment assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-asawicki committed Nov 26, 2024
1 parent 5f6aa31 commit 547b096
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
5 changes: 5 additions & 0 deletions pkg/acceptance/helpers/tmp_user_setup_helpers.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package helpers

import (
"fmt"
"testing"

"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/acceptance/helpers/random"
Expand Down Expand Up @@ -82,6 +83,10 @@ type TmpUser struct {
AccountId sdk.AccountIdentifier
}

func (u *TmpUser) OrgAndAccount() string {
return fmt.Sprintf("%s-%s", u.AccountId.OrganizationName(), u.AccountId.AccountName())
}

type TmpServiceUser struct {
PublicKey string
PrivateKey string
Expand Down
12 changes: 6 additions & 6 deletions pkg/provider/provider_acceptance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,14 +227,14 @@ func TestAcc_Provider_tomlConfig(t *testing.T) {
Config: providerConfig(tmpServiceUserConfig.Profile),
Check: func(s *terraform.State) error {
config := acc.TestAccProvider.Meta().(*internalprovider.Context).Client.GetConfig()
// assert.Equal(t, account, config.Account)
assert.Equal(t, tmpServiceUser.OrgAndAccount(), config.Account)
assert.Equal(t, tmpServiceUser.UserId.Name(), config.User)
assert.Equal(t, tmpServiceUser.WarehouseId.Name(), config.Warehouse)
assert.Equal(t, tmpServiceUser.RoleId.Name(), config.Role)
assert.Equal(t, gosnowflake.ConfigBoolTrue, config.ValidateDefaultParameters)
assert.Equal(t, net.ParseIP("1.2.3.4"), config.ClientIP)
assert.Equal(t, "https", config.Protocol)
// assert.Equal(t, fmt.Sprintf("%s.snowflakecomputing.com", account), config.Host)
assert.Equal(t, fmt.Sprintf("%s.snowflakecomputing.com", tmpServiceUser.OrgAndAccount()), config.Host)
assert.Equal(t, 443, config.Port)
assert.Equal(t, gosnowflake.AuthTypeJwt, config.Authenticator)
assert.Equal(t, false, config.PasscodeInPassword)
Expand Down Expand Up @@ -339,14 +339,14 @@ func TestAcc_Provider_envConfig(t *testing.T) {
Check: func(s *terraform.State) error {
config := acc.TestAccProvider.Meta().(*internalprovider.Context).Client.GetConfig()

// assert.Equal(t, account, config.Account)
assert.Equal(t, tmpServiceUser.OrgAndAccount(), config.Account)
assert.Equal(t, tmpServiceUser.UserId.Name(), config.User)
assert.Equal(t, tmpServiceUser.WarehouseId.Name(), config.Warehouse)
assert.Equal(t, tmpServiceUser.RoleId.Name(), config.Role)
assert.Equal(t, gosnowflake.ConfigBoolTrue, config.ValidateDefaultParameters)
assert.Equal(t, net.ParseIP("2.2.2.2"), config.ClientIP)
assert.Equal(t, "https", config.Protocol)
// assert.Equal(t, fmt.Sprintf("%s.snowflakecomputing.com", account), config.Host)
assert.Equal(t, fmt.Sprintf("%s.snowflakecomputing.com", tmpServiceUser.OrgAndAccount()), config.Host)
assert.Equal(t, 443, config.Port)
assert.Equal(t, gosnowflake.AuthTypeJwt, config.Authenticator)
assert.Equal(t, false, config.PasscodeInPassword)
Expand Down Expand Up @@ -451,14 +451,14 @@ func TestAcc_Provider_tfConfig(t *testing.T) {
Check: func(s *terraform.State) error {
config := acc.TestAccProvider.Meta().(*internalprovider.Context).Client.GetConfig()

// assert.Equal(t, account, config.Account)
assert.Equal(t, tmpServiceUser.OrgAndAccount(), config.Account)
assert.Equal(t, tmpServiceUser.UserId.Name(), config.User)
assert.Equal(t, tmpServiceUser.WarehouseId.Name(), config.Warehouse)
assert.Equal(t, tmpServiceUser.RoleId.Name(), config.Role)
assert.Equal(t, gosnowflake.ConfigBoolTrue, config.ValidateDefaultParameters)
assert.Equal(t, net.ParseIP("3.3.3.3"), config.ClientIP)
assert.Equal(t, "https", config.Protocol)
// assert.Equal(t, fmt.Sprintf("%s.snowflakecomputing.com", account), config.Host)
assert.Equal(t, fmt.Sprintf("%s.snowflakecomputing.com", tmpServiceUser.OrgAndAccount()), config.Host)
assert.Equal(t, 443, config.Port)
assert.Equal(t, gosnowflake.AuthTypeJwt, config.Authenticator)
assert.Equal(t, false, config.PasscodeInPassword)
Expand Down

0 comments on commit 547b096

Please sign in to comment.