Skip to content

Commit

Permalink
Review
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-jmichalak committed Nov 15, 2024
1 parent 1fccbd8 commit ee5104b
Show file tree
Hide file tree
Showing 41 changed files with 222 additions and 217 deletions.
8 changes: 4 additions & 4 deletions pkg/acceptance/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ func ExternalProviderWithExactVersion(version string) map[string]resource.Extern
}
}

// SetV097CompatibleConfigPath sets a new config path in a relevant env variable for a file that is compatible with v0.97.
func SetV097CompatibleConfigPathEnv(t *testing.T) func() {
// SetV097CompatibleConfigPathEnvFunc sets a new config path in a relevant env variable for a file that is compatible with v0.97.
func SetV097CompatibleConfigPathEnvFunc(t *testing.T) func() {
t.Helper()
return func() {
home, err := os.UserHomeDir()
Expand All @@ -222,8 +222,8 @@ func SetV097CompatibleConfigPathEnv(t *testing.T) func() {
}
}

// UnsetConfigPathEnv unsets a config path env
func UnsetConfigPathEnv(t *testing.T) func() {
// UnsetConfigPathEnvFunc unsets a config path env
func UnsetConfigPathEnvFunc(t *testing.T) func() {
t.Helper()
return func() {
t.Setenv(snowflakeenvs.ConfigPath, "")
Expand Down
2 changes: 1 addition & 1 deletion pkg/provider/provider_acceptance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ func TestAcc_Provider_triValueBoolean(t *testing.T) {
},
Steps: []resource.TestStep{
{
PreConfig: acc.SetV097CompatibleConfigPathEnv(t),
PreConfig: acc.SetV097CompatibleConfigPathEnvFunc(t),
ExternalProviders: acc.ExternalProviderWithExactVersion("0.97.0"),
Config: providerConfigWithClientStoreTemporaryCredential(testprofiles.Default, `true`),
},
Expand Down
8 changes: 4 additions & 4 deletions pkg/resources/account_role_acceptance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ func TestAcc_AccountRole_migrateFromV0941_ensureSmoothUpgradeWithNewResourceId(t
CheckDestroy: acc.CheckDestroy(t, resources.AccountRole),
Steps: []resource.TestStep{
{
PreConfig: acc.SetV097CompatibleConfigPathEnv(t),
PreConfig: acc.SetV097CompatibleConfigPathEnvFunc(t),
ExternalProviders: map[string]resource.ExternalProvider{
"snowflake": {
VersionConstraint: "=0.94.1",
Expand All @@ -230,7 +230,7 @@ func TestAcc_AccountRole_migrateFromV0941_ensureSmoothUpgradeWithNewResourceId(t
),
},
{
PreConfig: acc.UnsetConfigPathEnv(t),
PreConfig: acc.UnsetConfigPathEnvFunc(t),
ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories,
Config: accountRoleBasicConfig(id.Name(), comment),
Check: resource.ComposeAggregateTestCheckFunc(
Expand All @@ -254,7 +254,7 @@ func TestAcc_AccountRole_WithQuotedName(t *testing.T) {
CheckDestroy: acc.CheckDestroy(t, resources.AccountRole),
Steps: []resource.TestStep{
{
PreConfig: acc.SetV097CompatibleConfigPathEnv(t),
PreConfig: acc.SetV097CompatibleConfigPathEnvFunc(t),
ExternalProviders: map[string]resource.ExternalProvider{
"snowflake": {
VersionConstraint: "=0.94.1",
Expand All @@ -269,7 +269,7 @@ func TestAcc_AccountRole_WithQuotedName(t *testing.T) {
),
},
{
PreConfig: acc.UnsetConfigPathEnv(t),
PreConfig: acc.UnsetConfigPathEnvFunc(t),
ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories,
Config: accountRoleBasicConfig(quotedId, comment),
ConfigPlanChecks: resource.ConfigPlanChecks{
Expand Down
4 changes: 2 additions & 2 deletions pkg/resources/alert_acceptance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ func TestAcc_Alert_Issue3117(t *testing.T) {
CheckDestroy: acc.CheckDestroy(t, resources.Alert),
Steps: []resource.TestStep{
{
PreConfig: acc.SetV097CompatibleConfigPathEnv(t),
PreConfig: acc.SetV097CompatibleConfigPathEnvFunc(t),
ExternalProviders: map[string]resource.ExternalProvider{
"snowflake": {
VersionConstraint: "=0.92.0",
Expand All @@ -229,7 +229,7 @@ func TestAcc_Alert_Issue3117(t *testing.T) {
),
},
{
PreConfig: acc.UnsetConfigPathEnv(t),
PreConfig: acc.UnsetConfigPathEnvFunc(t),
ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories,
Config: alertIssue3117Config(id, acc.TestClient().Ids.WarehouseId(), "test_alert"),
Check: resource.ComposeTestCheckFunc(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ func TestAcc_ApiAuthenticationIntegrationWithAuthorizationCodeGrant_migrateFromV
CheckDestroy: acc.CheckDestroy(t, resources.ApiAuthenticationIntegrationWithAuthorizationCodeGrant),
Steps: []resource.TestStep{
{
PreConfig: acc.SetV097CompatibleConfigPathEnv(t),
PreConfig: acc.SetV097CompatibleConfigPathEnvFunc(t),
ExternalProviders: map[string]resource.ExternalProvider{
"snowflake": {
VersionConstraint: "=0.94.1",
Expand All @@ -284,7 +284,7 @@ func TestAcc_ApiAuthenticationIntegrationWithAuthorizationCodeGrant_migrateFromV
),
},
{
PreConfig: acc.UnsetConfigPathEnv(t),
PreConfig: acc.UnsetConfigPathEnvFunc(t),
ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories,
Config: apiAuthenticationIntegrationWithAuthorizationCodeGrantBasicConfig(id.Name()),
Check: resource.ComposeAggregateTestCheckFunc(
Expand All @@ -307,7 +307,7 @@ func TestAcc_ApiAuthenticationIntegrationWithAuthorizationCodeGrant_WithQuotedNa
CheckDestroy: acc.CheckDestroy(t, resources.ApiAuthenticationIntegrationWithAuthorizationCodeGrant),
Steps: []resource.TestStep{
{
PreConfig: acc.SetV097CompatibleConfigPathEnv(t),
PreConfig: acc.SetV097CompatibleConfigPathEnvFunc(t),
ExternalProviders: map[string]resource.ExternalProvider{
"snowflake": {
VersionConstraint: "=0.94.1",
Expand All @@ -322,7 +322,7 @@ func TestAcc_ApiAuthenticationIntegrationWithAuthorizationCodeGrant_WithQuotedNa
),
},
{
PreConfig: acc.UnsetConfigPathEnv(t),
PreConfig: acc.UnsetConfigPathEnvFunc(t),
ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories,
Config: apiAuthenticationIntegrationWithAuthorizationCodeGrantBasicConfig(quotedId),
ConfigPlanChecks: resource.ConfigPlanChecks{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ func TestAcc_ApiAuthenticationIntegrationWithClientCredentials_migrateFromV0941_
CheckDestroy: acc.CheckDestroy(t, resources.ApiAuthenticationIntegrationWithClientCredentials),
Steps: []resource.TestStep{
{
PreConfig: acc.SetV097CompatibleConfigPathEnv(t),
PreConfig: acc.SetV097CompatibleConfigPathEnvFunc(t),
ExternalProviders: map[string]resource.ExternalProvider{
"snowflake": {
VersionConstraint: "=0.94.1",
Expand All @@ -277,7 +277,7 @@ func TestAcc_ApiAuthenticationIntegrationWithClientCredentials_migrateFromV0941_
),
},
{
PreConfig: acc.UnsetConfigPathEnv(t),
PreConfig: acc.UnsetConfigPathEnvFunc(t),
ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories,
Config: apiAuthenticationIntegrationWithClientCredentialsBasicConfig(id.Name()),
Check: resource.ComposeAggregateTestCheckFunc(
Expand All @@ -300,7 +300,7 @@ func TestAcc_ApiAuthenticationIntegrationWithClientCredentials_WithQuotedName(t
CheckDestroy: acc.CheckDestroy(t, resources.ApiAuthenticationIntegrationWithClientCredentials),
Steps: []resource.TestStep{
{
PreConfig: acc.SetV097CompatibleConfigPathEnv(t),
PreConfig: acc.SetV097CompatibleConfigPathEnvFunc(t),
ExternalProviders: map[string]resource.ExternalProvider{
"snowflake": {
VersionConstraint: "=0.94.1",
Expand All @@ -315,7 +315,7 @@ func TestAcc_ApiAuthenticationIntegrationWithClientCredentials_WithQuotedName(t
),
},
{
PreConfig: acc.UnsetConfigPathEnv(t),
PreConfig: acc.UnsetConfigPathEnvFunc(t),
ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories,
Config: apiAuthenticationIntegrationWithClientCredentialsBasicConfig(quotedId),
ConfigPlanChecks: resource.ConfigPlanChecks{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func TestAcc_ApiAuthenticationIntegrationWithJwtBearer_migrateFromV0941_ensureSm
CheckDestroy: acc.CheckDestroy(t, resources.ApiAuthenticationIntegrationWithJwtBearer),
Steps: []resource.TestStep{
{
PreConfig: acc.SetV097CompatibleConfigPathEnv(t),
PreConfig: acc.SetV097CompatibleConfigPathEnvFunc(t),
ExternalProviders: map[string]resource.ExternalProvider{
"snowflake": {
VersionConstraint: "=0.94.1",
Expand All @@ -245,7 +245,7 @@ func TestAcc_ApiAuthenticationIntegrationWithJwtBearer_migrateFromV0941_ensureSm
),
},
{
PreConfig: acc.UnsetConfigPathEnv(t),
PreConfig: acc.UnsetConfigPathEnvFunc(t),
ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories,
Config: apiAuthenticationIntegrationWithJwtBearerBasicConfig(id.Name()),
Check: resource.ComposeAggregateTestCheckFunc(
Expand All @@ -270,7 +270,7 @@ func TestAcc_ApiAuthenticationIntegrationWithJwtBearer_IdentifierQuotingDiffSupp
CheckDestroy: acc.CheckDestroy(t, resources.ApiAuthenticationIntegrationWithJwtBearer),
Steps: []resource.TestStep{
{
PreConfig: acc.SetV097CompatibleConfigPathEnv(t),
PreConfig: acc.SetV097CompatibleConfigPathEnvFunc(t),
ExternalProviders: map[string]resource.ExternalProvider{
"snowflake": {
VersionConstraint: "=0.94.1",
Expand All @@ -285,7 +285,7 @@ func TestAcc_ApiAuthenticationIntegrationWithJwtBearer_IdentifierQuotingDiffSupp
),
},
{
PreConfig: acc.UnsetConfigPathEnv(t),
PreConfig: acc.UnsetConfigPathEnvFunc(t),
ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories,
Config: apiAuthenticationIntegrationWithJwtBearerBasicConfig(quotedId),
ConfigPlanChecks: resource.ConfigPlanChecks{
Expand Down
16 changes: 8 additions & 8 deletions pkg/resources/database_acceptance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -980,7 +980,7 @@ func TestAcc_Database_UpgradeWithTheSameFieldsAsInTheOldOne(t *testing.T) {
CheckDestroy: acc.CheckDestroy(t, resources.Database),
Steps: []resource.TestStep{
{
PreConfig: acc.SetV097CompatibleConfigPathEnv(t),
PreConfig: acc.SetV097CompatibleConfigPathEnvFunc(t),
ExternalProviders: map[string]resource.ExternalProvider{
"snowflake": {
VersionConstraint: "=0.92.0",
Expand Down Expand Up @@ -1046,7 +1046,7 @@ func TestAcc_Database_UpgradeWithDataRetentionSet(t *testing.T) {
CheckDestroy: acc.CheckDestroy(t, resources.Database),
Steps: []resource.TestStep{
{
PreConfig: acc.SetV097CompatibleConfigPathEnv(t),
PreConfig: acc.SetV097CompatibleConfigPathEnvFunc(t),
ExternalProviders: map[string]resource.ExternalProvider{
"snowflake": {
VersionConstraint: "=0.92.0",
Expand Down Expand Up @@ -1110,7 +1110,7 @@ func TestAcc_Database_WithReplication(t *testing.T) {
CheckDestroy: acc.CheckDestroy(t, resources.Database),
Steps: []resource.TestStep{
{
PreConfig: acc.SetV097CompatibleConfigPathEnv(t),
PreConfig: acc.SetV097CompatibleConfigPathEnvFunc(t),
ExternalProviders: map[string]resource.ExternalProvider{
"snowflake": {
VersionConstraint: "=0.92.0",
Expand All @@ -1128,7 +1128,7 @@ func TestAcc_Database_WithReplication(t *testing.T) {
),
},
{
PreConfig: acc.UnsetConfigPathEnv(t),
PreConfig: acc.UnsetConfigPathEnvFunc(t),
ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories,
Config: databaseStateUpgraderWithReplicationNew(id, secondaryAccountIdentifier),
ConfigPlanChecks: resource.ConfigPlanChecks{
Expand Down Expand Up @@ -1271,7 +1271,7 @@ func TestAcc_Database_migrateFromV0941_ensureSmoothUpgradeWithNewResourceId(t *t
CheckDestroy: acc.CheckDestroy(t, resources.Database),
Steps: []resource.TestStep{
{
PreConfig: acc.SetV097CompatibleConfigPathEnv(t),
PreConfig: acc.SetV097CompatibleConfigPathEnvFunc(t),
ExternalProviders: map[string]resource.ExternalProvider{
"snowflake": {
VersionConstraint: "=0.94.1",
Expand All @@ -1284,7 +1284,7 @@ func TestAcc_Database_migrateFromV0941_ensureSmoothUpgradeWithNewResourceId(t *t
),
},
{
PreConfig: acc.UnsetConfigPathEnv(t),
PreConfig: acc.UnsetConfigPathEnvFunc(t),
ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories,
Config: databaseConfigBasic(id.Name()),
Check: resource.ComposeAggregateTestCheckFunc(
Expand Down Expand Up @@ -1321,7 +1321,7 @@ func TestAcc_Database_IdentifierQuotingDiffSuppression(t *testing.T) {
CheckDestroy: acc.CheckDestroy(t, resources.Database),
Steps: []resource.TestStep{
{
PreConfig: acc.SetV097CompatibleConfigPathEnv(t),
PreConfig: acc.SetV097CompatibleConfigPathEnvFunc(t),
ExternalProviders: map[string]resource.ExternalProvider{
"snowflake": {
VersionConstraint: "=0.94.1",
Expand All @@ -1338,7 +1338,7 @@ func TestAcc_Database_IdentifierQuotingDiffSuppression(t *testing.T) {
),
},
{
PreConfig: acc.UnsetConfigPathEnv(t),
PreConfig: acc.UnsetConfigPathEnvFunc(t),
ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories,
Config: databaseConfigBasicWithExternalVolumeAndCatalog(quotedId, quotedExternalVolumeId, quotedCatalogId),
ConfigPlanChecks: resource.ConfigPlanChecks{
Expand Down
8 changes: 4 additions & 4 deletions pkg/resources/database_role_acceptance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func TestAcc_DatabaseRole_migrateFromV0941_ensureSmoothUpgradeWithNewResourceId(
},
Steps: []resource.TestStep{
{
PreConfig: acc.SetV097CompatibleConfigPathEnv(t),
PreConfig: acc.SetV097CompatibleConfigPathEnvFunc(t),
ExternalProviders: map[string]resource.ExternalProvider{
"snowflake": {
VersionConstraint: "=0.94.1",
Expand All @@ -174,7 +174,7 @@ func TestAcc_DatabaseRole_migrateFromV0941_ensureSmoothUpgradeWithNewResourceId(
),
},
{
PreConfig: acc.UnsetConfigPathEnv(t),
PreConfig: acc.UnsetConfigPathEnvFunc(t),
ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories,
Config: config.FromModel(t, databaseRoleModelWithComment),
ConfigPlanChecks: resource.ConfigPlanChecks{
Expand Down Expand Up @@ -206,7 +206,7 @@ func TestAcc_DatabaseRole_IdentifierQuotingDiffSuppression(t *testing.T) {
},
Steps: []resource.TestStep{
{
PreConfig: acc.SetV097CompatibleConfigPathEnv(t),
PreConfig: acc.SetV097CompatibleConfigPathEnvFunc(t),
ExternalProviders: map[string]resource.ExternalProvider{
"snowflake": {
VersionConstraint: "=0.94.1",
Expand All @@ -222,7 +222,7 @@ func TestAcc_DatabaseRole_IdentifierQuotingDiffSuppression(t *testing.T) {
),
},
{
PreConfig: acc.UnsetConfigPathEnv(t),
PreConfig: acc.UnsetConfigPathEnvFunc(t),
ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories,
Config: config.FromModel(t, databaseRoleModelWithComment),
ConfigPlanChecks: resource.ConfigPlanChecks{
Expand Down
18 changes: 9 additions & 9 deletions pkg/resources/external_function_acceptance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ func TestAcc_ExternalFunction_migrateFromVersion085(t *testing.T) {

Steps: []resource.TestStep{
{
PreConfig: acc.SetV097CompatibleConfigPathEnv(t),
PreConfig: acc.SetV097CompatibleConfigPathEnvFunc(t),
ExternalProviders: map[string]resource.ExternalProvider{
"snowflake": {
VersionConstraint: "=0.85.0",
Expand Down Expand Up @@ -292,7 +292,7 @@ func TestAcc_ExternalFunction_migrateFromVersion085_issue2694_previousValuePrese

Steps: []resource.TestStep{
{
PreConfig: acc.SetV097CompatibleConfigPathEnv(t),
PreConfig: acc.SetV097CompatibleConfigPathEnvFunc(t),
ExternalProviders: map[string]resource.ExternalProvider{
"snowflake": {
VersionConstraint: "=0.85.0",
Expand Down Expand Up @@ -337,7 +337,7 @@ func TestAcc_ExternalFunction_migrateFromVersion085_issue2694_previousValueRemov

Steps: []resource.TestStep{
{
PreConfig: acc.SetV097CompatibleConfigPathEnv(t),
PreConfig: acc.SetV097CompatibleConfigPathEnvFunc(t),
ExternalProviders: map[string]resource.ExternalProvider{
"snowflake": {
VersionConstraint: "=0.85.0",
Expand Down Expand Up @@ -418,7 +418,7 @@ func TestAcc_ExternalFunction_HeaderParsing(t *testing.T) {
CheckDestroy: acc.CheckDestroy(t, resources.ExternalFunction),
Steps: []resource.TestStep{
{
PreConfig: acc.SetV097CompatibleConfigPathEnv(t),
PreConfig: acc.SetV097CompatibleConfigPathEnvFunc(t),
ExternalProviders: map[string]resource.ExternalProvider{
"snowflake": {
VersionConstraint: "=0.93.0",
Expand All @@ -440,7 +440,7 @@ func TestAcc_ExternalFunction_HeaderParsing(t *testing.T) {
ExpectNonEmptyPlan: true,
},
{
PreConfig: acc.UnsetConfigPathEnv(t),
PreConfig: acc.UnsetConfigPathEnvFunc(t),
ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories,
Config: externalFunctionConfigIssueCurlyHeader(id),
Check: resource.ComposeTestCheckFunc(
Expand Down Expand Up @@ -588,7 +588,7 @@ func TestAcc_ExternalFunction_EnsureSmoothResourceIdMigrationToV0950(t *testing.
CheckDestroy: acc.CheckDestroy(t, resources.ExternalFunction),
Steps: []resource.TestStep{
{
PreConfig: acc.SetV097CompatibleConfigPathEnv(t),
PreConfig: acc.SetV097CompatibleConfigPathEnvFunc(t),
ExternalProviders: map[string]resource.ExternalProvider{
"snowflake": {
VersionConstraint: "=0.94.1",
Expand All @@ -601,7 +601,7 @@ func TestAcc_ExternalFunction_EnsureSmoothResourceIdMigrationToV0950(t *testing.
),
},
{
PreConfig: acc.UnsetConfigPathEnv(t),
PreConfig: acc.UnsetConfigPathEnvFunc(t),
ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories,
Config: externalFunctionConfigWithMoreArguments(acc.TestDatabaseName, acc.TestSchemaName, name),
Check: resource.ComposeTestCheckFunc(
Expand Down Expand Up @@ -662,7 +662,7 @@ func TestAcc_ExternalFunction_EnsureSmoothResourceIdMigrationToV0950_WithoutArgu
CheckDestroy: acc.CheckDestroy(t, resources.ExternalFunction),
Steps: []resource.TestStep{
{
PreConfig: acc.SetV097CompatibleConfigPathEnv(t),
PreConfig: acc.SetV097CompatibleConfigPathEnvFunc(t),
ExternalProviders: map[string]resource.ExternalProvider{
"snowflake": {
VersionConstraint: "=0.94.1",
Expand All @@ -675,7 +675,7 @@ func TestAcc_ExternalFunction_EnsureSmoothResourceIdMigrationToV0950_WithoutArgu
),
},
{
PreConfig: acc.UnsetConfigPathEnv(t),
PreConfig: acc.UnsetConfigPathEnvFunc(t),
ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories,
Config: externalFunctionConfigWithoutArguments(acc.TestDatabaseName, acc.TestSchemaName, name),
Check: resource.ComposeTestCheckFunc(
Expand Down
Loading

0 comments on commit ee5104b

Please sign in to comment.