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

Updating documentation for testing migration #876

Merged
merged 1 commit into from
Nov 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions website/docs/plugin/framework/migrating/testing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ 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
http provider repository. The second step also uses `PlanOnly` to verify that a no-op plan is generated.
provider repository. The second step also uses `PlanOnly` to verify that a no-op plan is generated.

<Note>
The following is only applicable to managed resources.
</Note>

```go
func TestDataSource_UpgradeFromVersion(t *testing.T) {
Expand All @@ -52,17 +56,17 @@ func TestDataSource_UpgradeFromVersion(t *testing.T) {
Source: "hashicorp/<provider>",
},
},
Config: `data "provider_datasource" "example" {
Config: `resource "provider_resource" "example" {
/* ... */
}`,
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("data.provider_datasource.example", "<attribute>", "<value>"),
resource.TestCheckResourceAttr("provider_resource.example", "<attribute>", "<value>"),
/* ... */
),
},
{
ProtoV5ProviderFactories: protoV5ProviderFactories(),
Config: `data "provider_datasource" "example" {
Config: `resource "provider_resource" "example" {
/* ... */
}`,
PlanOnly: true,
Expand Down