acceptance tests - update plan check logic to not error if the resource isn't found in the plan #28640
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Community Note
Description
The plan check
CheckPlan
was introduced by #27319 to enable the acceptance testing shim to catch and error out from update tests that triggered aForceNew
. The current logic inCheckPlan
causes a number of acceptance tests in the provider to fail with an error similar to the one below:Tests failing with this error rely on a setup configuration as the first test step before applying the test configuration that's pertinent for testing the actual resource.
This PR inverts the logic in
CheckPlan
to only check for aReplace
action and error if the resource exists in the plan as opposed to error'ing if it's missing.Testing
Ideally the entire testing suite is run to catch any edge cases, given the size and scope of that it's not a feasible undertaking.
I ran three tests to validate the behaviour is as expected:
TestAccImage_standaloneImage
- previously failed, now passesTestAccAppConfigurationKey_basicNoValue
- failed because it triggers aForceNew
, still fails meaning the original intent of the check is still intactTestAccAppConfigurationKey_KVToVault
- passed, still passes