Skip to content

Commit

Permalink
ensure test runs for future versions of terraform
Browse files Browse the repository at this point in the history
runTestVersions should not be used where runTest and a version check would
suffice. Each call to runTestVersions must be manually updated when new
versions of Terraform are released, whereas runTest tests are run against all
known relevant releases.
  • Loading branch information
kmoe committed Feb 18, 2022
1 parent 039095f commit 493eef2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tfexec/internal/e2etest/providers_lock_test.go
Expand Up @@ -7,11 +7,17 @@ import (
"github.com/hashicorp/go-version"

"github.com/hashicorp/terraform-exec/tfexec"
"github.com/hashicorp/terraform-exec/tfexec/internal/testutil"
)

var (
providersLockMinVersion = version.Must(version.NewVersion("0.14.0"))
)

func TestProvidersLock(t *testing.T) {
runTestVersions(t, []string{testutil.Latest014, testutil.Latest015, testutil.Latest_v1}, "basic", func(t *testing.T, tfv *version.Version, tf *tfexec.Terraform) {
runTest(t, "basic", func(t *testing.T, tfv *version.Version, tf *tfexec.Terraform) {
if tfv.LessThan(providersLockMinVersion) {
t.Skip("terraform providers lock was added in Terraform 0.14, so test is not valid")
}
err := tf.Init(context.Background())
if err != nil {
t.Fatalf("error running Init in test directory: %s", err)
Expand Down

0 comments on commit 493eef2

Please sign in to comment.