helper/schema: fix test

This commit is contained in:
Mitchell Hashimoto 2014-08-17 19:32:11 -07:00
parent afd3a7b811
commit 7db585c257
2 changed files with 9 additions and 2 deletions

View File

@ -2,6 +2,7 @@ package schema
import ( import (
"fmt" "fmt"
"sort"
"github.com/hashicorp/terraform/terraform" "github.com/hashicorp/terraform/terraform"
) )
@ -65,8 +66,14 @@ func (p *Provider) Configure(c *terraform.ResourceConfig) error {
// Resources implementation of terraform.ResourceProvider interface. // Resources implementation of terraform.ResourceProvider interface.
func (p *Provider) Resources() []terraform.ResourceType { func (p *Provider) Resources() []terraform.ResourceType {
result := make([]terraform.ResourceType, 0, len(p.ResourcesMap)) keys := make([]string, 0, len(p.ResourcesMap))
for k, _ := range p.ResourcesMap { for k, _ := range p.ResourcesMap {
keys = append(keys, k)
}
sort.Strings(keys)
result := make([]terraform.ResourceType, 0, len(keys))
for _, k := range keys {
result = append(result, terraform.ResourceType{ result = append(result, terraform.ResourceType{
Name: k, Name: k,
}) })

View File

@ -99,8 +99,8 @@ func TestProviderResources(t *testing.T) {
}, },
}, },
Result: []terraform.ResourceType{ Result: []terraform.ResourceType{
terraform.ResourceType{Name: "foo"},
terraform.ResourceType{Name: "bar"}, terraform.ResourceType{Name: "bar"},
terraform.ResourceType{Name: "foo"},
}, },
}, },
} }