remove hard-coded opc provider and providers tests

This commit is contained in:
James Bardin 2017-06-12 10:00:09 -04:00
parent 1ab40eae35
commit 6fcc3e0104
2 changed files with 30 additions and 41 deletions

View File

@ -24,11 +24,11 @@ func main() {
log.Fatalf("This program must be invoked in the terraform project root; in %s", wd) 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 //// Collect all of the data we need about plugins we have in the project
providers, err := discoverProviders() //providers, err := discoverProviders()
if err != nil { //if err != nil {
log.Fatalf("Failed to discover providers: %s", err) // log.Fatalf("Failed to discover providers: %s", err)
} //}
provisioners, err := discoverProvisioners() provisioners, err := discoverProvisioners()
if err != nil { if err != nil {
@ -37,8 +37,8 @@ func main() {
// Do some simple code generation and templating // Do some simple code generation and templating
output := source output := source
output = strings.Replace(output, "IMPORTS", makeImports(providers, provisioners), 1) output = strings.Replace(output, "IMPORTS", makeImports(nil, provisioners), 1)
output = strings.Replace(output, "PROVIDERS", makeProviderMap(providers), 1) //output = strings.Replace(output, "PROVIDERS", makeProviderMap(providers), 1)
output = strings.Replace(output, "PROVISIONERS", makeProvisionerMap(provisioners), 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 // 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 ( import (
IMPORTS IMPORTS
"github.com/hashicorp/terraform/plugin" "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{ var InternalProviders = map[string]plugin.ProviderFunc{}
PROVIDERS
}
var InternalProvisioners = map[string]plugin.ProvisionerFunc{ var InternalProvisioners = map[string]plugin.ProvisionerFunc{
PROVISIONERS PROVISIONERS
} }
func init() {
// New Provider Layouts
InternalProviders["opc"] = func() terraform.ResourceProvider { return opcprovider.Provider() }
}
` `

View File

@ -62,28 +62,28 @@ func contains(plugins []plugin, name string) bool {
return false return false
} }
func TestDiscoverTypesProviders(t *testing.T) { //func TestDiscoverTypesProviders(t *testing.T) {
plugins, err := discoverTypesInPath("../builtin/providers", "terraform.ResourceProvider", "Provider") // plugins, err := discoverTypesInPath("../builtin/providers", "terraform.ResourceProvider", "Provider")
if err != nil { // if err != nil {
t.Fatalf(err.Error()) // t.Fatalf(err.Error())
} // }
// We're just going to spot-check, not do this exhaustively // // We're just going to spot-check, not do this exhaustively
if !contains(plugins, "aws") { // if !contains(plugins, "aws") {
t.Errorf("Expected to find aws provider") // t.Errorf("Expected to find aws provider")
} // }
if !contains(plugins, "docker") { // if !contains(plugins, "docker") {
t.Errorf("Expected to find docker provider") // t.Errorf("Expected to find docker provider")
} // }
if !contains(plugins, "dnsimple") { // if !contains(plugins, "dnsimple") {
t.Errorf("Expected to find dnsimple provider") // t.Errorf("Expected to find dnsimple provider")
} // }
if !contains(plugins, "triton") { // if !contains(plugins, "triton") {
t.Errorf("Expected to find triton provider") // t.Errorf("Expected to find triton provider")
} // }
if contains(plugins, "file") { // if contains(plugins, "file") {
t.Errorf("Found unexpected provider file") // t.Errorf("Found unexpected provider file")
} // }
} //}
func TestDiscoverTypesProvisioners(t *testing.T) { func TestDiscoverTypesProvisioners(t *testing.T) {
plugins, err := discoverTypesInPath("../builtin/provisioners", "terraform.ResourceProvisioner", "Provisioner") plugins, err := discoverTypesInPath("../builtin/provisioners", "terraform.ResourceProvisioner", "Provisioner")