You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Testing whether Read or Exists implementations are correctly removing resource from state, when it is gone currently requires significant number of LOC and leads to lack of such tests, which in turn then leads to bugs like this hashicorp/terraform#18931
The goal is to explore options for making such tests easier to write and generally making it easier to test such scenarios.
Would it make sense if this was a new boolean on TestStep? e.g. ExpectsRecreationIfDeleted (fixing my poor naming choice). It would automatically call the resource Delete function then ideally something similar to ExpectsNonEmptyPlan, but expecting a new resource in the difference rather than just any plan difference.
There are actually reasons to go beyond just a boolean here and instead accept a resource name from the Terraform state. Here's a great example: hashicorp/terraform-provider-aws#5914
Basically, ELBs can have children load balancer policies, which are wholly dependent on the ELB parent existing. In this case, for this acceptance testing I will actually need two separate TestStep's to verify the resource correctly catches both of the errors returned by the API:
One for removal of the load balancer policy (PolicyNotFound)
One for removal of the ELB (LoadBalancerNotFound)
The text was updated successfully, but these errors were encountered:
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
locked and limited conversation to collaborators
Feb 27, 2020
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Testing whether Read or Exists implementations are correctly removing resource from state, when it is gone currently requires significant number of LOC and leads to lack of such tests, which in turn then leads to bugs like this hashicorp/terraform#18931
The goal is to explore options for making such tests easier to write and generally making it easier to test such scenarios.
From @bflad :
This would save quite a few bug reports!
Would it make sense if this was a new boolean on
TestStep
? e.g.ExpectsRecreationIfDeleted
(fixing my poor naming choice). It would automatically call the resourceDelete
function then ideally something similar toExpectsNonEmptyPlan
, but expecting a new resource in the difference rather than just any plan difference.There are actually reasons to go beyond just a boolean here and instead accept a resource name from the Terraform state. Here's a great example: hashicorp/terraform-provider-aws#5914
Basically, ELBs can have children load balancer policies, which are wholly dependent on the ELB parent existing. In this case, for this acceptance testing I will actually need two separate TestStep's to verify the resource correctly catches both of the errors returned by the API:
The text was updated successfully, but these errors were encountered: