Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-jcieslak committed Dec 6, 2024
1 parent bbcbc2f commit 9893fab
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 16 deletions.

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

2 changes: 1 addition & 1 deletion pkg/acceptance/helpers/account_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func (c *AccountClient) CreateAndLogIn(t *testing.T) (*sdk.Account, *sdk.Client,
newClient, err := sdk.NewClient(&gosnowflake.Config{
Account: fmt.Sprintf("%s-%s", account.OrganizationName, account.AccountName),
User: name,
Host: strings.TrimPrefix(*account.AccountLocatorURL, `https://`),
Host: strings.TrimPrefix(*account.AccountLocatorUrl, `https://`),
Authenticator: gosnowflake.AuthTypeJwt,
PrivateKey: privateKey,
Role: snowflakeroles.Accountadmin.Name(),
Expand Down
2 changes: 1 addition & 1 deletion pkg/datasources/accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func ReadAccounts(ctx context.Context, d *schema.ResourceData, meta any) diag.Di
m["created_on"] = account.CreatedOn.String()
m["comment"] = account.Comment
m["account_locator"] = account.AccountLocator
m["account_locator_url"] = account.AccountLocatorURL
m["account_locator_url"] = account.AccountLocatorUrl
m["managed_accounts"] = account.ManagedAccounts
m["consumption_billing_entity_name"] = account.ConsumptionBillingEntityName
m["marketplace_consumer_billing_entity_name"] = account.MarketplaceConsumerBillingEntityName
Expand Down
4 changes: 2 additions & 2 deletions pkg/schemas/account_gen.go

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

4 changes: 2 additions & 2 deletions pkg/sdk/accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ type Account struct {
CreatedOn *time.Time
Comment *string
AccountLocator string
AccountLocatorURL *string
AccountLocatorUrl *string
ManagedAccounts *int
ConsumptionBillingEntityName *string
MarketplaceConsumerBillingEntityName *string
Expand Down Expand Up @@ -450,7 +450,7 @@ func (row accountDBRow) convert() *Account {
acc.Comment = &row.Comment.String
}
if row.AccountLocatorURL.Valid {
acc.AccountLocatorURL = &row.AccountLocatorURL.String
acc.AccountLocatorUrl = &row.AccountLocatorURL.String
}
if row.ManagedAccounts.Valid {
acc.ManagedAccounts = Int(int(row.ManagedAccounts.Int32))
Expand Down
5 changes: 2 additions & 3 deletions pkg/sdk/accounts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ package sdk
import (
"encoding/json"
"fmt"
"github.com/stretchr/testify/require"
"testing"

"github.com/stretchr/testify/assert"

"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/acceptance/helpers/random"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func TestAccountCreate(t *testing.T) {
Expand Down
7 changes: 3 additions & 4 deletions pkg/sdk/testint/accounts_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func TestInt_Account(t *testing.T) {
assert.NotEmpty(t, *account.CreatedOn)
assert.Equal(t, "SNOWFLAKE", *account.Comment)
assert.NotEmpty(t, account.AccountLocator)
assert.NotEmpty(t, *account.AccountLocatorURL)
assert.NotEmpty(t, *account.AccountLocatorUrl)
assert.Zero(t, *account.ManagedAccounts)
assert.NotEmpty(t, *account.ConsumptionBillingEntityName)
assert.Nil(t, account.MarketplaceConsumerBillingEntityName)
Expand Down Expand Up @@ -65,7 +65,7 @@ func TestInt_Account(t *testing.T) {
assert.Nil(t, account.AccountURL)
assert.Nil(t, account.CreatedOn)
assert.Nil(t, account.Comment)
assert.Nil(t, account.AccountLocatorURL)
assert.Nil(t, account.AccountLocatorUrl)
assert.Nil(t, account.ManagedAccounts)
assert.Nil(t, account.ConsumptionBillingEntityName)
assert.Nil(t, account.MarketplaceConsumerBillingEntityName)
Expand Down Expand Up @@ -97,8 +97,7 @@ func TestInt_Account(t *testing.T) {
assert.NotNil(t, response)
if response != nil {
assert.Equal(t, account.AccountLocator, response.AccountLocator)
// TODO: Rename to Url
assert.Equal(t, *account.AccountLocatorURL, response.AccountLocatorUrl)
assert.Equal(t, *account.AccountLocatorUrl, response.AccountLocatorUrl)
assert.Equal(t, account.AccountName, response.AccountName)
assert.Equal(t, *account.AccountURL, response.Url)
assert.Equal(t, account.OrganizationName, response.OrganizationName)
Expand Down

0 comments on commit 9893fab

Please sign in to comment.