From 6fcc3e0104455d556bc0545730fc414534255ee0 Mon Sep 17 00:00:00 2001 From: James Bardin Date: Mon, 12 Jun 2017 10:00:09 -0400 Subject: [PATCH] remove hard-coded opc provider and providers tests --- scripts/generate-plugins.go | 27 ++++++-------------- scripts/generate-plugins_test.go | 44 ++++++++++++++++---------------- 2 files changed, 30 insertions(+), 41 deletions(-) diff --git a/scripts/generate-plugins.go b/scripts/generate-plugins.go index 415123891..2b0c7686b 100644 --- a/scripts/generate-plugins.go +++ b/scripts/generate-plugins.go @@ -24,11 +24,11 @@ func main() { log.Fatalf("This program must be invoked in the terraform project root; in %s", wd) } - // Collect all of the data we need about plugins we have in the project - providers, err := discoverProviders() - if err != nil { - log.Fatalf("Failed to discover providers: %s", err) - } + //// Collect all of the data we need about plugins we have in the project + //providers, err := discoverProviders() + //if err != nil { + // log.Fatalf("Failed to discover providers: %s", err) + //} provisioners, err := discoverProvisioners() if err != nil { @@ -37,8 +37,8 @@ func main() { // Do some simple code generation and templating output := source - output = strings.Replace(output, "IMPORTS", makeImports(providers, provisioners), 1) - output = strings.Replace(output, "PROVIDERS", makeProviderMap(providers), 1) + output = strings.Replace(output, "IMPORTS", makeImports(nil, provisioners), 1) + //output = strings.Replace(output, "PROVIDERS", makeProviderMap(providers), 1) output = strings.Replace(output, "PROVISIONERS", makeProvisionerMap(provisioners), 1) // TODO sort the lists of plugins so we are not subjected to random OS ordering of the plugin lists @@ -268,22 +268,11 @@ package command import ( IMPORTS "github.com/hashicorp/terraform/plugin" - "github.com/hashicorp/terraform/terraform" - - //New Provider Builds - opcprovider "github.com/hashicorp/terraform-provider-opc/opc" ) -var InternalProviders = map[string]plugin.ProviderFunc{ -PROVIDERS -} +var InternalProviders = map[string]plugin.ProviderFunc{} var InternalProvisioners = map[string]plugin.ProvisionerFunc{ PROVISIONERS } - -func init() { - // New Provider Layouts - InternalProviders["opc"] = func() terraform.ResourceProvider { return opcprovider.Provider() } -} ` diff --git a/scripts/generate-plugins_test.go b/scripts/generate-plugins_test.go index 5979ee28f..cba015b85 100644 --- a/scripts/generate-plugins_test.go +++ b/scripts/generate-plugins_test.go @@ -62,28 +62,28 @@ func contains(plugins []plugin, name string) bool { return false } -func TestDiscoverTypesProviders(t *testing.T) { - plugins, err := discoverTypesInPath("../builtin/providers", "terraform.ResourceProvider", "Provider") - if err != nil { - t.Fatalf(err.Error()) - } - // We're just going to spot-check, not do this exhaustively - if !contains(plugins, "aws") { - t.Errorf("Expected to find aws provider") - } - if !contains(plugins, "docker") { - t.Errorf("Expected to find docker provider") - } - if !contains(plugins, "dnsimple") { - t.Errorf("Expected to find dnsimple provider") - } - if !contains(plugins, "triton") { - t.Errorf("Expected to find triton provider") - } - if contains(plugins, "file") { - t.Errorf("Found unexpected provider file") - } -} +//func TestDiscoverTypesProviders(t *testing.T) { +// plugins, err := discoverTypesInPath("../builtin/providers", "terraform.ResourceProvider", "Provider") +// if err != nil { +// t.Fatalf(err.Error()) +// } +// // We're just going to spot-check, not do this exhaustively +// if !contains(plugins, "aws") { +// t.Errorf("Expected to find aws provider") +// } +// if !contains(plugins, "docker") { +// t.Errorf("Expected to find docker provider") +// } +// if !contains(plugins, "dnsimple") { +// t.Errorf("Expected to find dnsimple provider") +// } +// if !contains(plugins, "triton") { +// t.Errorf("Expected to find triton provider") +// } +// if contains(plugins, "file") { +// t.Errorf("Found unexpected provider file") +// } +//} func TestDiscoverTypesProvisioners(t *testing.T) { plugins, err := discoverTypesInPath("../builtin/provisioners", "terraform.ResourceProvisioner", "Provisioner")