Skip to content

Commit

Permalink
Add metadata functions unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
dbanck committed Feb 8, 2023
1 parent c410148 commit 252f514
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tfexec/metadata_functions_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package tfexec

import (
"context"
"testing"

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

func TestMetadataFunctionsCmd(t *testing.T) {
td := t.TempDir()

tf, err := NewTerraform(td, tfVersion(t, testutil.Latest_v1_1))
// tf, err := NewTerraform(td, tfVersion(t, testutil.Latest_v1_4)) // TODO! enable after 1.4 release
if err != nil {
t.Fatal(err)
}

// empty env, to avoid environ mismatch in testing
tf.SetEnv(map[string]string{})

functionsCmd := tf.metadataFunctionsCmd(context.Background())

assertCmd(t, []string{
"metadata",
"functions",
"-json",
}, nil, functionsCmd)
}

0 comments on commit 252f514

Please sign in to comment.