|
| 1 | +// Copyright (c) HashiCorp, Inc. |
| 2 | +// SPDX-License-Identifier: MPL-2.0 |
| 3 | + |
| 4 | +package tfversion_test |
| 5 | + |
| 6 | +import ( |
| 7 | + "testing" |
| 8 | + |
| 9 | + "github.com/hashicorp/terraform-plugin-go/tfprotov6" |
| 10 | + |
| 11 | + r "github.com/hashicorp/terraform-plugin-testing/helper/resource" |
| 12 | + "github.com/hashicorp/terraform-plugin-testing/internal/testing/testprovider" |
| 13 | + "github.com/hashicorp/terraform-plugin-testing/internal/testing/testsdk/providerserver" |
| 14 | + "github.com/hashicorp/terraform-plugin-testing/tfversion" |
| 15 | + |
| 16 | + testinginterface "github.com/mitchellh/go-testing-interface" |
| 17 | +) |
| 18 | + |
| 19 | +func Test_SkipIfNotAlpha_SkipTest_Stable(t *testing.T) { //nolint:paralleltest |
| 20 | + t.Setenv("TF_ACC_TERRAFORM_PATH", "") |
| 21 | + t.Setenv("TF_ACC_TERRAFORM_VERSION", "1.8.0") |
| 22 | + |
| 23 | + r.UnitTest(t, r.TestCase{ |
| 24 | + ProtoV6ProviderFactories: map[string]func() (tfprotov6.ProviderServer, error){ |
| 25 | + "test": func() (tfprotov6.ProviderServer, error) { //nolint:unparam // required signature |
| 26 | + return nil, nil |
| 27 | + }, |
| 28 | + }, |
| 29 | + TerraformVersionChecks: []tfversion.TerraformVersionCheck{ |
| 30 | + tfversion.SkipIfNotAlpha(), |
| 31 | + }, |
| 32 | + Steps: []r.TestStep{ |
| 33 | + { |
| 34 | + Config: `//non-empty config`, |
| 35 | + }, |
| 36 | + }, |
| 37 | + }) |
| 38 | +} |
| 39 | + |
| 40 | +func Test_SkipIfNotAlpha_SkipTest_Beta1(t *testing.T) { //nolint:paralleltest |
| 41 | + t.Setenv("TF_ACC_TERRAFORM_PATH", "") |
| 42 | + t.Setenv("TF_ACC_TERRAFORM_VERSION", "1.8.0-beta1") |
| 43 | + |
| 44 | + r.UnitTest(t, r.TestCase{ |
| 45 | + ProtoV6ProviderFactories: map[string]func() (tfprotov6.ProviderServer, error){ |
| 46 | + "test": providerserver.NewProviderServer(testprovider.Provider{}), |
| 47 | + }, |
| 48 | + TerraformVersionChecks: []tfversion.TerraformVersionCheck{ |
| 49 | + tfversion.SkipIfNotAlpha(), |
| 50 | + }, |
| 51 | + Steps: []r.TestStep{ |
| 52 | + { |
| 53 | + Config: `//non-empty config`, |
| 54 | + }, |
| 55 | + }, |
| 56 | + }) |
| 57 | +} |
| 58 | +func Test_SkipIfNotAlpha_SkipTest_RC(t *testing.T) { //nolint:paralleltest |
| 59 | + t.Setenv("TF_ACC_TERRAFORM_PATH", "") |
| 60 | + t.Setenv("TF_ACC_TERRAFORM_VERSION", "1.8.0-rc2") |
| 61 | + |
| 62 | + r.UnitTest(t, r.TestCase{ |
| 63 | + ProtoV6ProviderFactories: map[string]func() (tfprotov6.ProviderServer, error){ |
| 64 | + "test": providerserver.NewProviderServer(testprovider.Provider{}), |
| 65 | + }, |
| 66 | + TerraformVersionChecks: []tfversion.TerraformVersionCheck{ |
| 67 | + tfversion.SkipIfNotAlpha(), |
| 68 | + }, |
| 69 | + Steps: []r.TestStep{ |
| 70 | + { |
| 71 | + Config: `//non-empty config`, |
| 72 | + }, |
| 73 | + }, |
| 74 | + }) |
| 75 | +} |
| 76 | + |
| 77 | +func Test_SkipIfNotAlpha_RunTest_Alpha(t *testing.T) { //nolint:paralleltest |
| 78 | + t.Setenv("TF_ACC_TERRAFORM_PATH", "") |
| 79 | + t.Setenv("TF_ACC_TERRAFORM_VERSION", "1.9.0-alpha20240501") |
| 80 | + |
| 81 | + r.UnitTest(&testinginterface.RuntimeT{}, r.TestCase{ |
| 82 | + ProtoV6ProviderFactories: map[string]func() (tfprotov6.ProviderServer, error){ |
| 83 | + "test": providerserver.NewProviderServer(testprovider.Provider{}), |
| 84 | + }, |
| 85 | + TerraformVersionChecks: []tfversion.TerraformVersionCheck{ |
| 86 | + tfversion.SkipIfNotAlpha(), |
| 87 | + }, |
| 88 | + Steps: []r.TestStep{ |
| 89 | + { |
| 90 | + Config: `//non-empty config`, |
| 91 | + }, |
| 92 | + }, |
| 93 | + }) |
| 94 | +} |
0 commit comments