Use tfversion variables instead of go-version directly for function testing (#221)
Reference: https://github.com/hashicorp/terraform-provider-scaffolding-framework/pull/220 Consuming developers should not directly need to worry about `github.com/hashicorp/go-version` unless they want to use that Go module. Provider-defined functions testing was releasing in this template repository before the Terraform 1.8.0 version variable in the terraform-plugin-testing `tfversion` package was available. Now that the variable is present, we can remove go-version as a direct dependency, simplifying both the code and dependency management slightly.
This commit is contained in:
parent
cfae236219
commit
37b9fa0171
2
go.mod
2
go.mod
@ -3,7 +3,6 @@ module github.com/hashicorp/terraform-provider-scaffolding-framework
|
||||
go 1.21
|
||||
|
||||
require (
|
||||
github.com/hashicorp/go-version v1.6.0
|
||||
github.com/hashicorp/terraform-plugin-docs v0.19.2
|
||||
github.com/hashicorp/terraform-plugin-framework v1.8.0
|
||||
github.com/hashicorp/terraform-plugin-go v0.23.0
|
||||
@ -37,6 +36,7 @@ require (
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
github.com/hashicorp/go-plugin v1.6.0 // indirect
|
||||
github.com/hashicorp/go-uuid v1.0.3 // indirect
|
||||
github.com/hashicorp/go-version v1.6.0 // indirect
|
||||
github.com/hashicorp/hc-install v0.6.4 // indirect
|
||||
github.com/hashicorp/hcl/v2 v2.20.1 // indirect
|
||||
github.com/hashicorp/logutils v1.0.0 // indirect
|
||||
|
@ -7,7 +7,6 @@ import (
|
||||
"regexp"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/go-version"
|
||||
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
|
||||
"github.com/hashicorp/terraform-plugin-testing/tfversion"
|
||||
)
|
||||
@ -15,7 +14,7 @@ import (
|
||||
func TestExampleFunction_Known(t *testing.T) {
|
||||
resource.UnitTest(t, resource.TestCase{
|
||||
TerraformVersionChecks: []tfversion.TerraformVersionCheck{
|
||||
tfversion.SkipBelow(version.Must(version.NewVersion("1.8.0"))),
|
||||
tfversion.SkipBelow(tfversion.Version1_8_0),
|
||||
},
|
||||
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
|
||||
Steps: []resource.TestStep{
|
||||
@ -36,7 +35,7 @@ func TestExampleFunction_Known(t *testing.T) {
|
||||
func TestExampleFunction_Null(t *testing.T) {
|
||||
resource.UnitTest(t, resource.TestCase{
|
||||
TerraformVersionChecks: []tfversion.TerraformVersionCheck{
|
||||
tfversion.SkipBelow(version.Must(version.NewVersion("1.8.0"))),
|
||||
tfversion.SkipBelow(tfversion.Version1_8_0),
|
||||
},
|
||||
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
|
||||
Steps: []resource.TestStep{
|
||||
@ -56,7 +55,7 @@ func TestExampleFunction_Null(t *testing.T) {
|
||||
func TestExampleFunction_Unknown(t *testing.T) {
|
||||
resource.UnitTest(t, resource.TestCase{
|
||||
TerraformVersionChecks: []tfversion.TerraformVersionCheck{
|
||||
tfversion.SkipBelow(version.Must(version.NewVersion("1.8.0"))),
|
||||
tfversion.SkipBelow(tfversion.Version1_8_0),
|
||||
},
|
||||
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
|
||||
Steps: []resource.TestStep{
|
||||
|
Loading…
x
Reference in New Issue
Block a user