Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Improves backup_compliance_policy test #2484

Merged
merged 1 commit into from
Aug 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func TestAccBackupCompliancePolicy_UpdateSetsAllAttributes(t *testing.T) {
ProtoV6ProviderFactories: acc.TestAccProviderV6Factories,
Steps: []resource.TestStep{
{
Config: configBasicWithOptionalAttributesWithNonDefaultValues(projectName, orgID, projectOwnerID),
Config: configBasicWithOptionalAttributesWithNonDefaultValues(projectName, orgID, projectOwnerID, "7"),
Check: resource.ComposeAggregateTestCheckFunc(
checkExists(resourceName),
resource.TestCheckResourceAttr(resourceName, "authorized_user_first_name", "First"),
Expand All @@ -140,7 +140,18 @@ func TestAccBackupCompliancePolicy_UpdateSetsAllAttributes(t *testing.T) {
),
},
{
Config: configBasicWithOptionalAttributesWithNonDefaultValues(projectName, orgID, projectOwnerID),
Config: configBasicWithOptionalAttributesWithNonDefaultValues(projectName, orgID, projectOwnerID, "8"),
Check: resource.ComposeAggregateTestCheckFunc(
checkExists(resourceName),
resource.TestCheckResourceAttr(resourceName, "authorized_user_first_name", "First"),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any way of checking the restore_window_days here?

resource.TestCheckResourceAttr(resourceName, "authorized_user_last_name", "Last"),
resource.TestCheckResourceAttr(resourceName, "pit_enabled", "false"),
resource.TestCheckResourceAttr(resourceName, "encryption_at_rest_enabled", "false"),
resource.TestCheckResourceAttr(resourceName, "copy_protection_enabled", "true"),
),
},
{
Config: configBasicWithOptionalAttributesWithNonDefaultValues(projectName, orgID, projectOwnerID, "8"),
ConfigPlanChecks: resource.ConfigPlanChecks{
PreApply: []plancheck.PlanCheck{
acc.DebugPlan(),
Expand Down Expand Up @@ -456,9 +467,9 @@ func basicChecks() []resource.TestCheckFunc {
return checks
}

func configBasicWithOptionalAttributesWithNonDefaultValues(projectName, orgID, projectOwnerID string) string {
func configBasicWithOptionalAttributesWithNonDefaultValues(projectName, orgID, projectOwnerID, restreWindowDays string) string {
return acc.ConfigProjectWithSettings(projectName, orgID, projectOwnerID, false) +
`resource "mongodbatlas_backup_compliance_policy" "backup_policy_res" {
fmt.Sprintf(`resource "mongodbatlas_backup_compliance_policy" "backup_policy_res" {
project_id = mongodbatlas_project.test.id
authorized_email = "[email protected]"
authorized_user_first_name = "First"
Expand All @@ -467,7 +478,7 @@ func configBasicWithOptionalAttributesWithNonDefaultValues(projectName, orgID, p
pit_enabled = false
encryption_at_rest_enabled = false

restore_window_days = 7
restore_window_days = %[1]s

on_demand_policy_item {
frequency_interval = 0
Expand Down Expand Up @@ -498,5 +509,5 @@ func configBasicWithOptionalAttributesWithNonDefaultValues(projectName, orgID, p
retention_unit = "months"
retention_value = 12
}
}`
}`, restreWindowDays)
}
Loading