Skip to content

Commit

Permalink
website: Use ConfigPlanChecks instead of PlanOnly in migration testing (
Browse files Browse the repository at this point in the history
  • Loading branch information
bflad authored Jan 2, 2024
1 parent 791e37b commit 2a97b81
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions website/docs/plugin/framework/migrating/testing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ and then verify that there are no planned changes after migrating to the Framewo
- The first `TestStep` uses `ExternalProviders` to cause `terraform apply` to execute with a previous version of the
provider, which is built on SDKv2.
- The second `TestStep` uses `ProtoV5ProviderFactories` so that the test uses the provider code contained within the
provider repository. The second step also uses `PlanOnly` to verify that a no-op plan is generated.
provider repository. The second step uses `ConfigPlanChecks` to verify that a no-op plan is generated.

#### Managed Resource

Expand Down Expand Up @@ -69,7 +69,16 @@ func TestResource_UpgradeFromVersion(t *testing.T) {
Config: `resource "provider_resource" "example" {
/* ... */
}`,
PlanOnly: true,
// ConfigPlanChecks is a terraform-plugin-testing feature.
// If acceptance testing is still using terraform-plugin-sdk/v2,
// use `PlanOnly: true` instead. When migrating to
// terraform-plugin-testing, switch to `ConfigPlanChecks` or you
// will likely experience test failures.
ConfigPlanChecks: resource.ConfigPlanChecks{
PreApply: []plancheck.PlanCheck{
plancheck.ExpectEmptyPlan(),
},
},
},
},
})
Expand Down Expand Up @@ -117,7 +126,16 @@ func TestDataSource_UpgradeFromVersion(t *testing.T) {
resource "terraform_data" "test" {
input = data.provider_datasource.test
}`,
PlanOnly: true,
// ConfigPlanChecks is a terraform-plugin-testing feature.
// If acceptance testing is still using terraform-plugin-sdk/v2,
// use `PlanOnly: true` instead. When migrating to
// terraform-plugin-testing, switch to `ConfigPlanChecks` or you
// will likely experience test failures.
ConfigPlanChecks: resource.ConfigPlanChecks{
PreApply: []plancheck.PlanCheck{
plancheck.ExpectEmptyPlan(),
},
},
},
},
})
Expand Down

0 comments on commit 2a97b81

Please sign in to comment.