From 5a975d99975aada282587bafb74796efcc98f471 Mon Sep 17 00:00:00 2001 From: James Bardin Date: Fri, 5 Jan 2018 11:51:09 -0500 Subject: [PATCH] add test for internal plugins with -plugin-dir -plugin-dir was short-circuiting the discovery for internal plugins --- command/init_test.go | 24 +++++++++++++++++++++ command/test-fixtures/init-internal/main.tf | 1 + 2 files changed, 25 insertions(+) create mode 100644 command/test-fixtures/init-internal/main.tf diff --git a/command/init_test.go b/command/init_test.go index b47936f057..cd611301b7 100644 --- a/command/init_test.go +++ b/command/init_test.go @@ -1063,3 +1063,27 @@ func TestInit_pluginDirProvidersDoesNotGet(t *testing.T) { t.Fatalf("bad: \n%s", ui.OutputWriter) } } + +// Verify that plugin-dir doesn't prevent discovery of internal providers +func TestInit_pluginWithInternal(t *testing.T) { + td := tempDir(t) + copy.CopyDir(testFixturePath("init-internal"), td) + defer os.RemoveAll(td) + defer testChdir(t, td)() + + ui := new(cli.MockUi) + m := Meta{ + testingOverrides: metaOverridesForProvider(testProvider()), + Ui: ui, + } + + c := &InitCommand{ + Meta: m, + } + + args := []string{"-plugin-dir", "./"} + //args := []string{} + if code := c.Run(args); code != 0 { + t.Fatalf("error: %s", ui.ErrorWriter) + } +} diff --git a/command/test-fixtures/init-internal/main.tf b/command/test-fixtures/init-internal/main.tf new file mode 100644 index 0000000000..962d7114bd --- /dev/null +++ b/command/test-fixtures/init-internal/main.tf @@ -0,0 +1 @@ +provider "terraform" {}