-
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
Add RemoveState option to TestStep #118
Conversation
@bflad I've tried to implement 2nd version of your proposal, could you have a look? |
hey guys, what do you think about this changes? @bendbennett could you help with review? |
Hi @vmanilo 👋 I've added the triage label to this PR. We will discuss the changes that you have proposed in an upcoming Team triage meeting. |
anything pending to get this change merged in? Would love to have this to test upgrade suites |
Hi, any plans to get this in? |
@frezbo apologies but have still to triage this issue. We will provide an update once the team have had a chance to review the proposed changes. |
Thank you ❤️ |
Is there a temporary fix for this as I see the upstream is not being triaged yet |
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.
Hi there @vmanilo 👋🏻 , thanks for submitting this change.
Taking a quick high level look at this PR, we'll need a couple things before we can approve:
- Automated tests to verify the functionality (not all of the testing framework currently has testing, but for new functionality we'll need it to ensure, after merging, we don't introduce any regressions later on)
- Test Step validation mentioned in the original issue (The validation logic can be added here: https://github.com/hashicorp/terraform-plugin-testing/blob/main/helper/resource/teststep_validate.go#L65)
From #85
In this scenario, the following validation should be performed:
- RemoveState is not present in the same TestStep as Config: "not empty", ImportState: true, or RefreshState: true
- RemoveState is not present in the first TestStep of TestCase.Steps, similar to RefreshState
hey @austinvalle |
hey guys 👋 any updates? |
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.
Thanks for making those updates @vmanilo ! This is looking good so far, two notes:
- Small suggestions on the PR files related to the Go package docs
- Can you also add a description for this new "test mode" to our website doc? It's a markdown file here:
terraform-plugin-testing/website/docs/plugin/testing/acceptance-tests/teststep.mdx
Line 15 in fd9dc5e
## Test Modes
helper/resource/testing.go
Outdated
@@ -476,6 +476,12 @@ type TestStep struct { | |||
// resources in the root module path. | |||
Taint []string | |||
|
|||
// RemoveState list of resource addresses to be removed from state after |
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.
// RemoveState list of resource addresses to be removed from state after | |
// RemoveState is a list of resource addresses to be removed from state after |
helper/resource/testing.go
Outdated
// applying config. Be sure to only include this at a step where the referenced | ||
// address will be present in state, as it will fail the test if the resource | ||
// is missing. | ||
RemoveState []string |
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.
I think it would make sense to move this definition under the comments mentioning Test modes
on line 486. As the intention is for this RemoveState
option to be it's own "mode".
Maybe also adding to this doc comment that RemoveState
is not meant to be used in the same TestStep
with other modes like Config
or ImportState
?
Oh! I forgot, a new changelog entry will also be needed for this. We use a tool called changie, you can read about in our contributing docs. I think this falls into the enhancement category, here is a recent PR with some examples of changelogs. |
- added changelog
hey @austinvalle 👋 I've addressed your proposals, please take a look |
guys, when someone has time, please take a look |
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.
Thanks for making those changes @vmanilo and I appreciate the patience. I made a couple suggestions to change the wording (which I believe I can commit, but wanted to make them as suggestions), but everything else looks good 👍🏻 .
We have a couple other features merging to plugin-testing
this week, so I'm hoping to get this merged in alongside or following those.
Co-authored-by: Austin Valle <[email protected]>
Co-authored-by: Austin Valle <[email protected]>
thank you @austinvalle, this wording change looks good to me :) |
Hi there @vmanilo, sorry about the slow responses, but we've been discussing this PR internally and we've decided that we want to hold off on merging any additional functionality to the I'll be closing this PR, but will also provide some of our thoughts on state removal in general for testing and what upcoming solutions should help. State removal is/should be a very exceptional behavior for provider testing. For better or worse, most managed resources that operate as singletons support “import on create” like behavior and automatically do state removal behavior rather than destroying anything. In the near/medium term (current forecast looks like As for the matter of Again, apologies for the back and forth on this PR. |
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. |
Resolves #85