From 9573d1bfec50d7bf802d49ad2c1535bbf0f924f7 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 9 Sep 2014 17:41:05 -0700 Subject: [PATCH] terraform: test to make sure nil in RawConfig is okay --- terraform/resource_test.go | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/terraform/resource_test.go b/terraform/resource_test.go index 69886ccb5b..b2edff5c12 100644 --- a/terraform/resource_test.go +++ b/terraform/resource_test.go @@ -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 {