-
Notifications
You must be signed in to change notification settings - Fork 166
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
test: Fixes tests after updating terraform-plugin-testing from 1.5.1 to 1.6.0 #1792
Conversation
Bumps [github.com/hashicorp/terraform-plugin-testing](https://github.com/hashicorp/terraform-plugin-testing) from 1.5.1 to 1.6.0. - [Release notes](https://github.com/hashicorp/terraform-plugin-testing/releases) - [Changelog](https://github.com/hashicorp/terraform-plugin-testing/blob/main/CHANGELOG.md) - [Commits](hashicorp/terraform-plugin-testing@v1.5.1...v1.6.0) --- updated-dependencies: - dependency-name: github.com/hashicorp/terraform-plugin-testing dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
…ate and not in the config
…rror during execution of test
5cfcbf4
to
be7c4b2
Compare
failing test in cluster group (TestAccClusterRSCluster_tenant) is not related, will followup with a CLOUDP ticket for that issue as I am also seeing it in QA executions (flaky scenario). Also ran all acceptance tests/migrations test to verify no other failing test was left out after the fix. |
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
}, | ||
}, | ||
PlanOnly: true, |
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.
Should we do a quick search/replace of PlanOnly
in the repo? 👀
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.
sorry I did not understand this point
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.
just updated the message. I am wondering if we should search for PlanOnly
in the repo and remove it
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.
yeah, was waiting for confirmation here as the migration test documentation still mentions PlanOnly
usage. Can do this in a followup PR.
}, | ||
}, | ||
PlanOnly: true, |
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.
[not-blocking] Should we document these errors somewhere so that we do not forget them in the future? I am not sure about an ideal location 🤔 leave this here to think about it
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.
Our terraform wiki can be good starting point, helpful for referencing in the future if it is encountered again.
@@ -1451,9 +1451,9 @@ func TestAccClusterRSCluster_withDefaultBiConnectorAndAdvancedConfiguration_main | |||
ConfigPlanChecks: resource.ConfigPlanChecks{ | |||
PostApplyPreRefresh: []plancheck.PlanCheck{ | |||
acc.DebugPlan(), |
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.
do we still need this as well?
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 noting, not necessary as ExpectEmptyPlan() gives details of the plan if it is non empty.
Description
Link to any related issue(s): CLOUDP-219141
This PR uses the dependabot PR as the base branch which is updating
terraform-plugin-testing
from 1.5.1 to 1.6.0.Due to some changes introduced in this new version some of our tests where impacted (seen in the following CI execution that was triggered manually):
The failing test are due to 2 causes.
1. Changes in the behaviour of
PlanOnly
I raised an issue to HashiCorp with the details of the failing test and guidance was provided: hashicorp/terraform-plugin-testing#256.
In summary, the failing case defines a migration test from an old provider version to the latest, and during these version one attribute is removed from the schema. After
terraform-plugin-testing
v1.6.0 when usingPlanOnly
the state is not automatically updated with the current provider schema before the destroy begins, leading to the error.The suggested way moving forward is to avoid using
PlanOnly: true
, and instead use plancheck.ExpectEmptyPlan(). This is only needed when the underlying provider schema changes between TestSteps.2. Changes in the behaviour of
ImportState
Examples of the failing test:
As seen in the message, after
terraform-plugin-testing
v1.6.0 theImportStateVerify: true,
config verifies if there are attributes that are present in the state, but not in the config. Before this version this check only verified missing attributes in the state. I verified that in both cases these additional attributes do not cause a non-empty plan (and also added in test cases), and add these additional attribute in theImportStateVerifyIgnore
array.Type of change:
Required Checklist:
Further comments