From 475d8750bbbb0adb5e26c2bdadc986cbfc232322 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 26 Aug 2016 13:38:02 -0700 Subject: [PATCH] command/push: make test more resilient --- command/push_test.go | 18 +++++++++++++++++- .../0aec430d87a09fa44453780d5bb00156/main.tf | 1 - 2 files changed, 17 insertions(+), 2 deletions(-) delete mode 100644 command/test-fixtures/push-no-upload/DOTterraform/modules/0aec430d87a09fa44453780d5bb00156/main.tf diff --git a/command/push_test.go b/command/push_test.go index 0a26712f2..b48add166 100644 --- a/command/push_test.go +++ b/command/push_test.go @@ -6,6 +6,7 @@ import ( "compress/gzip" "io" "os" + "path/filepath" "reflect" "sort" "testing" @@ -91,11 +92,26 @@ func TestPush_noUploadModules(t *testing.T) { // Path of the test. We have to do some renaming to avoid our own // VCS getting in the way. path := testFixturePath("push-no-upload") - defer testRename(t, path, "DOTterraform", ".terraform")() + defer os.RemoveAll(filepath.Join(path, ".terraform")) // Move into that directory defer testChdir(t, path)() + // Do a "terraform get" + { + ui := new(cli.MockUi) + c := &GetCommand{ + Meta: Meta{ + ContextOpts: testCtxConfig(testProvider()), + Ui: ui, + }, + } + + if code := c.Run([]string{}); code != 0 { + t.Fatalf("bad: \n%s", ui.ErrorWriter.String()) + } + } + // Create remote state file, this should be pulled conf, srv := testRemoteState(t, testState(), 200) defer srv.Close() diff --git a/command/test-fixtures/push-no-upload/DOTterraform/modules/0aec430d87a09fa44453780d5bb00156/main.tf b/command/test-fixtures/push-no-upload/DOTterraform/modules/0aec430d87a09fa44453780d5bb00156/main.tf deleted file mode 100644 index fec56017d..000000000 --- a/command/test-fixtures/push-no-upload/DOTterraform/modules/0aec430d87a09fa44453780d5bb00156/main.tf +++ /dev/null @@ -1 +0,0 @@ -# Hello