terraform: test to make sure nil in RawConfig is okay

This commit is contained in:
Mitchell Hashimoto 2014-09-09 17:41:05 -07:00
parent a53faa2fff
commit 9573d1bfec
1 changed files with 14 additions and 4 deletions

View File

@ -39,6 +39,12 @@ func TestResourceConfigGet(t *testing.T) {
Key string
Value interface{}
}{
{
Config: nil,
Key: "foo",
Value: nil,
},
{
Config: map[string]interface{}{
"foo": "${var.foo}",
@ -74,12 +80,16 @@ func TestResourceConfigGet(t *testing.T) {
}
for i, tc := range cases {
rawC, err := config.NewRawConfig(tc.Config)
if err != nil {
t.Fatalf("err: %s", err)
var rawC *config.RawConfig
if tc.Config != nil {
var err error
rawC, err = config.NewRawConfig(tc.Config)
if err != nil {
t.Fatalf("err: %s", err)
}
}
rc := NewResourceConfig(rawC)
rc := NewResourceConfig(rawC)
if tc.Vars != nil {
ctx := NewContext(&ContextOpts{Variables: tc.Vars})
if err := rc.interpolate(ctx); err != nil {