terraform: more tests

This commit is contained in:
Mitchell Hashimoto 2015-02-09 11:20:32 -08:00
parent 533d63dda3
commit 23bb182732
1 changed files with 20 additions and 0 deletions

View File

@ -1,6 +1,7 @@
package terraform
import (
"reflect"
"strings"
"testing"
@ -62,6 +63,7 @@ func TestGraphNodeConfigResource_impl(t *testing.T) {
var _ dag.NamedVertex = new(GraphNodeConfigResource)
var _ graphNodeConfig = new(GraphNodeConfigResource)
var _ GraphNodeProviderConsumer = new(GraphNodeConfigResource)
var _ GraphNodeProvisionerConsumer = new(GraphNodeConfigResource)
}
func TestGraphNodeConfigResource_ProvidedBy(t *testing.T) {
@ -74,6 +76,24 @@ func TestGraphNodeConfigResource_ProvidedBy(t *testing.T) {
}
}
func TestGraphNodeConfigResource_ProvisionedBy(t *testing.T) {
n := &GraphNodeConfigResource{
Resource: &config.Resource{
Type: "aws_instance",
Provisioners: []*config.Provisioner{
&config.Provisioner{Type: "foo"},
&config.Provisioner{Type: "bar"},
},
},
}
expected := []string{"foo", "bar"}
actual := n.ProvisionedBy()
if !reflect.DeepEqual(actual, expected) {
t.Fatalf("bad: %#v", actual)
}
}
const testGraphNodeModuleExpandStr = `
aws_instance.bar
aws_instance.foo