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)
}
// 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() }
}
`

View File

@ -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")