-
Notifications
You must be signed in to change notification settings - Fork 11
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
all: Add deferred action testing support (plan checks, version check, and CLI options) #331
Conversation
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.
LGTM! Only one non-blocking question about a potential new check.
|
||
// ExpectNoDeferredChanges returns a plan check that asserts that there are no deffered changes | ||
// for any resources in the plan. | ||
func ExpectNoDeferredChanges() PlanCheck { |
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.
Would it be useful to have a ExpectNoDeferredChange
plan check assertion for a single resource?
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.
Good question! Off the top of my head I can't think of a specific testing flow that would need a negative check like that.
My initial thought is that most tests would follow the general flow of testing a single resource:
- Test step 1: Check a resource is causing a plan to be deferred
- Test step 2: Check there are no more deferred changes (i.e. no more rounds needed)
I'm not sure if there is a workflow where a test may want to end before all deferred changes are satisfied, but maybe more provider developer usage will let us know if that'd be beneficial.
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.
LGTM 🚀
This PR adds a couple different things all towards supporting testing deferred actions:
DeferredChanges
andComplete
toPlan
JSON terraform-json#123TestCase
field for enabling a limited set of flags, in this scenario, the-allow-deferral
flag, ref: tfexec: Add-allow-deferral
experimental options toPlan
andApply
commands terraform-exec#447terraform-plugin-go
version tov0.23.0
to help with testing the new plan checks, ref: tfprotov5+tfprotov6: Add deferred action support to related RPCs terraform-plugin-go#403testprovider
to implement the now required methods fromterraform-plugin-go