-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Using Protov5ProviderFactories in tests for compatibility with TF >= …
…0.12 (#177)
- Loading branch information
1 parent
e95a34c
commit 97ed28f
Showing
8 changed files
with
40 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,30 @@ | ||
package provider_fm | ||
|
||
import ( | ||
"context" | ||
"github.com/hashicorp/terraform-plugin-framework/providerserver" | ||
"github.com/hashicorp/terraform-plugin-go/tfprotov5" | ||
"github.com/hashicorp/terraform-plugin-go/tfprotov6" | ||
"github.com/hashicorp/terraform-plugin-mux/tf6to5server" | ||
"log" | ||
"testing" | ||
) | ||
|
||
func testAccPreCheck(t *testing.T) { | ||
} | ||
|
||
//nolint:unparam | ||
var testAccProtoV6ProviderFactories = map[string]func() (tfprotov6.ProviderServer, error){ | ||
"random": func() (tfprotov6.ProviderServer, error) { | ||
return providerserver.NewProtocol6(NewFramework())(), nil | ||
}, | ||
func testAccProtoV5ProviderFactories() map[string]func() (tfprotov5.ProviderServer, error) { | ||
downgradedFrameworkProvider, err := tf6to5server.DowngradeServer(context.Background(), func() tfprotov6.ProviderServer { | ||
return providerserver.NewProtocol6(NewFramework())() | ||
}) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
return map[string]func() (tfprotov5.ProviderServer, error){ | ||
"random": func() (tfprotov5.ProviderServer, error) { | ||
return downgradedFrameworkProvider, nil | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters