-
Notifications
You must be signed in to change notification settings - Fork 118
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
testing: Update acceptance tests to use new statecheck
package and value comparers
#599
Conversation
resource.TestCheckNoResourceAttr("random_password.default", "numeric"), | ||
beforeUpgradeStateChecks: []statecheck.StateCheck{ | ||
statecheck.ExpectKnownValue("random_password.default", tfjsonpath.New("number"), knownvalue.Bool(true)), | ||
randomtest.ExpectNoAttribute("random_password.default", tfjsonpath.New("numeric")), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A fun (and expected) quirk of our new state checks are that they will recognize if an attribute doesn't exist and fail, so certain usages of resource.TestCheckNoResourceAttr
will not be able to be replaced by statecheck.ExpectKnownValue
with a knownvalue.Null()
I'm not sure how common it is to check for an attribute not existing, but if it's common we can move the ExpectNoAttribute
into the terraform-plugin-testing
Go module
Ref: hashicorp/terraform-plugin-testing#295, hashicorp/terraform-plugin-testing#266
With this refactor, all of the assertions should be equivalent except for a few where I made the test assertions more restrictive/exact. Let me know if I missed anything!