diff --git a/pkg/acceptance/helpers/database_client.go b/pkg/acceptance/helpers/database_client.go index 06eb35488b4..2e9c71cf238 100644 --- a/pkg/acceptance/helpers/database_client.go +++ b/pkg/acceptance/helpers/database_client.go @@ -110,18 +110,16 @@ func (c *DatabaseClient) CreatePrimaryDatabase(t *testing.T, enableReplicationTo return primaryDatabase, externalPrimaryId, primaryDatabaseCleanup } -func (c *DatabaseClient) UpdateDataRetentionTime(t *testing.T, id sdk.AccountObjectIdentifier, days int) func() { +func (c *DatabaseClient) UpdateDataRetentionTime(t *testing.T, id sdk.AccountObjectIdentifier, days int) { t.Helper() ctx := context.Background() - return func() { - err := c.client().Alter(ctx, id, &sdk.AlterDatabaseOptions{ - Set: &sdk.DatabaseSet{ - DataRetentionTimeInDays: sdk.Int(days), - }, - }) - require.NoError(t, err) - } + err := c.client().Alter(ctx, id, &sdk.AlterDatabaseOptions{ + Set: &sdk.DatabaseSet{ + DataRetentionTimeInDays: sdk.Int(days), + }, + }) + require.NoError(t, err) } func (c *DatabaseClient) UnsetCatalog(t *testing.T, id sdk.AccountObjectIdentifier) { diff --git a/pkg/resources/database_acceptance_test.go b/pkg/resources/database_acceptance_test.go index 86e9702be8c..7c5724cd07e 100644 --- a/pkg/resources/database_acceptance_test.go +++ b/pkg/resources/database_acceptance_test.go @@ -755,7 +755,8 @@ func TestAcc_Database_IntParameter(t *testing.T) { ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ planchecks.PrintPlanDetails("snowflake_database.test", "data_retention_time_in_days"), - planchecks.ExpectChange("snowflake_database.test", "data_retention_time_in_days", tfjson.ActionNoop, sdk.String("25"), sdk.String("25")), + planchecks.ExpectDrift("snowflake_database.test", "data_retention_time_in_days", sdk.String("25"), sdk.String("50")), + planchecks.ExpectChange("snowflake_database.test", "data_retention_time_in_days", tfjson.ActionUpdate, sdk.String("50"), sdk.String("25")), planchecks.ExpectComputed("snowflake_database.test", "data_retention_time_in_days", false), }, }, @@ -874,7 +875,7 @@ func TestAcc_Database_IntParameter(t *testing.T) { ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ planchecks.PrintPlanDetails("snowflake_database.test", "data_retention_time_in_days"), - planchecks.ExpectChange("snowflake_database.test", "data_retention_time_in_days", tfjson.ActionNoop, sdk.String("50"), sdk.String("50")), + planchecks.ExpectChange("snowflake_database.test", "data_retention_time_in_days", tfjson.ActionUpdate, sdk.String("50"), nil), planchecks.ExpectComputed("snowflake_database.test", "data_retention_time_in_days", false), }, }, diff --git a/pkg/resources/database_old_acceptance_test.go b/pkg/resources/database_old_acceptance_test.go index 0ffb9f04e81..37cc76d7aaf 100644 --- a/pkg/resources/database_old_acceptance_test.go +++ b/pkg/resources/database_old_acceptance_test.go @@ -306,7 +306,7 @@ func TestAcc_Database_DefaultDataRetentionTime_SetOutsideOfTerraform(t *testing. ), }, { - PreConfig: acc.TestClient().Database.UpdateDataRetentionTime(t, id, 20), + PreConfig: func() { acc.TestClient().Database.UpdateDataRetentionTime(t, id, 20) }, ConfigDirectory: acc.ConfigurationDirectory("TestAcc_Database_DefaultDataRetentionTime/WithoutDataRetentionSet"), ConfigVariables: configVariablesWithoutDatabaseDataRetentionTime(), Check: resource.ComposeTestCheckFunc(