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

Binary testing: omit test cleanup when state is empty #356

Merged
merged 1 commit into from
Apr 19, 2020

Conversation

kmoe
Copy link
Member

@kmoe kmoe commented Mar 15, 2020

Fixes #347

The legacy test framework does not attempt a post-test destroy step when there is no state: https://github.com/hashicorp/terraform-plugin-sdk/blob/master/helper/resource/testing.go#L701

This was missed out of the new framework, with the consequence that successful tests that do not create resources would error during cleanup.

We add this check back, in new binary testing style - the nuance here being that our state may well contain modules but no resources.

Again, I'll raise a separate PR to the version2 branch after review.

@kmoe kmoe requested a review from a team March 15, 2020 10:52
@paultyng paultyng requested review from a team and removed request for a team March 16, 2020 13:27
Copy link
Contributor

@appilon appilon left a comment

Choose a reason for hiding this comment

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

Curious is it possible to have a test validate this behavior? If effort is too high for that at this time this is ready to merge

@kmoe kmoe merged commit 6d8f88b into master Apr 19, 2020
@kmoe kmoe deleted the omit-test-cleanup-when-no-state branch April 19, 2020 12:15
kmoe added a commit that referenced this pull request Apr 19, 2020
@kmoe kmoe removed the port-to-v2 label Apr 19, 2020
@ghost
Copy link

ghost commented May 20, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators May 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Binary Test Driver: ExpectError fail to destroy for invalid config
2 participants