Skip to content

Commit

Permalink
fix: run_terraform_tests in AWS and GovCloud
Browse files Browse the repository at this point in the history
[#187103734](https://www.pivotaltracker.com/story/show/187103734)

Recently, a new PR for validating this property was merged:
hashicorp/terraform-provider-aws#35870

I believe it's valuable to have our tests break when changes
like this are introduced in the providers. Therefore, we should
try have behaviours such as this encoded in our tests. Things
like: "invalid values for property X are not validated by TF".
  • Loading branch information
fnaranjo-vmw committed Feb 26, 2024
1 parent 036ae7d commit 81c6a4c
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions terraform-tests/mssql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -739,19 +739,14 @@ var _ = Describe("mssql", Label("mssql-terraform"), Ordered, func() {
})

When("an invalid retention period is passed", func() {
It("doesn't detect any errors and plan finishes succesfully", func() {
It("should fail and return a descriptive error message", func() {
// invalid values for the retention_period are handled by the IAAS not Terraform
plan := ShowPlan(terraformProvisionDir, buildVars(defaultVars, requiredVars, map[string]any{
session, _ := FailPlan(terraformProvisionDir, buildVars(defaultVars, requiredVars, map[string]any{
"performance_insights_enabled": true,
"performance_insights_retention_period": 13,
}))

Expect(AfterValuesForType(plan, "aws_db_instance")).To(
MatchKeys(IgnoreExtras, Keys{
"performance_insights_enabled": BeTrue(),
"performance_insights_retention_period": BeNumerically("==", 13),
}),
)
Expect(session.ExitCode()).NotTo(Equal(0))
Expect(session).To(gbytes.Say("expected performance_insights_retention_period to be divisible by 31, got: 13"))
})
})
})
Expand Down

0 comments on commit 81c6a4c

Please sign in to comment.