Skip to content

Commit

Permalink
rename StateShow to Show
Browse files Browse the repository at this point in the history
  • Loading branch information
kmoe committed Jul 13, 2020
1 parent c11057b commit 230dc9c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion tfexec/import_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func TestImport(t *testing.T) {
t.Fatal(err)
}

state, err := tf.StateShow(ctx)
state, err := tf.Show(ctx)
if err != nil {
t.Fatal(err)
}
Expand Down
6 changes: 3 additions & 3 deletions tfexec/show.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import (
tfjson "github.com/hashicorp/terraform-json"
)

func (tf *Terraform) StateShow(ctx context.Context) (*tfjson.State, error) {
func (tf *Terraform) Show(ctx context.Context) (*tfjson.State, error) {
var ret tfjson.State

var errBuf strings.Builder
var outBuf bytes.Buffer

showCmd := tf.stateShowCmd(ctx)
showCmd := tf.showCmd(ctx)

showCmd.Stderr = &errBuf
showCmd.Stdout = &outBuf
Expand All @@ -39,7 +39,7 @@ func (tf *Terraform) StateShow(ctx context.Context) (*tfjson.State, error) {
return &ret, nil
}

func (tf *Terraform) stateShowCmd(ctx context.Context, args ...string) *exec.Cmd {
func (tf *Terraform) showCmd(ctx context.Context, args ...string) *exec.Cmd {
allArgs := []string{"show", "-json", "-no-color"}
allArgs = append(allArgs, args...)

Expand Down
10 changes: 5 additions & 5 deletions tfexec/show_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
tfjson "github.com/hashicorp/terraform-json"
)

func TestStateShow(t *testing.T) {
func TestShow(t *testing.T) {
td := testTempDir(t)
defer os.RemoveAll(td)

Expand Down Expand Up @@ -52,7 +52,7 @@ func TestStateShow(t *testing.T) {
t.Fatalf("error running Init in test directory: %s", err)
}

actual, err := tf.StateShow(context.Background())
actual, err := tf.Show(context.Background())
if err != nil {
t.Fatal(err)
}
Expand All @@ -73,7 +73,7 @@ func TestShow_errInitRequired(t *testing.T) {

err = copyFile(filepath.Join(testFixtureDir, "basic", testTerraformStateFileName), td)

_, err = tf.StateShow(context.Background())
_, err = tf.Show(context.Background())
if err == nil {
t.Fatal("expected Show to error, but it did not")
} else {
Expand All @@ -84,7 +84,7 @@ func TestShow_errInitRequired(t *testing.T) {

}

func TestStateShowCmd(t *testing.T) {
func TestShowCmd(t *testing.T) {
td := testTempDir(t)
defer os.RemoveAll(td)

Expand All @@ -94,7 +94,7 @@ func TestStateShowCmd(t *testing.T) {
}

// defaults
showCmd := tf.stateShowCmd(context.Background())
showCmd := tf.showCmd(context.Background())

actual := strings.TrimPrefix(cmdString(showCmd), showCmd.Path+" ")

Expand Down

0 comments on commit 230dc9c

Please sign in to comment.