From d1b930d5b551ed7c809172df4637facfc2bd8dd4 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 2 Mar 2017 11:21:48 -0800 Subject: [PATCH] command: remove unused test --- command/hook_ui_test.go | 62 ----------------------------------------- terraform/resource.go | 13 --------- 2 files changed, 75 deletions(-) diff --git a/command/hook_ui_test.go b/command/hook_ui_test.go index c80ac6850..1c6476efe 100644 --- a/command/hook_ui_test.go +++ b/command/hook_ui_test.go @@ -1,72 +1,10 @@ package command import ( - "bytes" "fmt" "testing" - "time" - - "github.com/hashicorp/terraform/terraform" - "github.com/mitchellh/cli" - "github.com/mitchellh/colorstring" ) -func TestUiHookPostApply_emptyState(t *testing.T) { - colorize := &colorstring.Colorize{ - Colors: colorstring.DefaultColors, - Disable: true, - Reset: true, - } - - ir := bytes.NewReader([]byte{}) - errBuf := bytes.NewBuffer([]byte{}) - outBuf := bytes.NewBuffer([]byte{}) - ui := cli.MockUi{ - InputReader: ir, - ErrorWriter: errBuf, - OutputWriter: outBuf, - } - h := &UiHook{ - Colorize: colorize, - Ui: &ui, - } - h.init() - h.resources = map[string]uiResourceState{ - "data.google_compute_zones.available": uiResourceState{ - Op: uiResourceDestroy, - Start: time.Now(), - }, - } - - mock := &terraform.MockInstanceInfo{ - terraform.InstanceInfo{ - Id: "data.google_compute_zones.available", - ModulePath: []string{"root"}, - Type: "google_compute_zones", - }, - } - n := mock.WithUniqueExtra("destroy") - action, err := h.PostApply(n, nil, nil) - if err != nil { - t.Fatal(err) - } - if action != terraform.HookActionContinue { - t.Fatalf("Expected hook to continue, given: %#v", action) - } - - expectedOutput := "" - output := outBuf.String() - if output != expectedOutput { - t.Fatalf("Output didn't match.\nExpected: %q\nGiven: %q", expectedOutput, output) - } - - expectedErrOutput := "" - errOutput := errBuf.String() - if errOutput != expectedErrOutput { - t.Fatalf("Error output didn't match.\nExpected: %q\nGiven: %q", expectedErrOutput, errOutput) - } -} - func TestTruncateId(t *testing.T) { testCases := []struct { Input string diff --git a/terraform/resource.go b/terraform/resource.go index b1f5822f6..0acf0beb2 100644 --- a/terraform/resource.go +++ b/terraform/resource.go @@ -72,19 +72,6 @@ type InstanceInfo struct { uniqueExtra string } -type MockInstanceInfo struct { - InstanceInfo -} - -func (m *MockInstanceInfo) WithUniqueExtra(extra string) *InstanceInfo { - return &InstanceInfo{ - Id: m.Id, - ModulePath: m.ModulePath, - Type: m.Type, - uniqueExtra: extra, - } -} - // HumanId is a unique Id that is human-friendly and useful for UI elements. func (i *InstanceInfo) HumanId() string { if i == nil {