From 220c2be571d7b41a4428221540de5e6018d1ba0c Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 9 Feb 2015 11:21:16 -0800 Subject: [PATCH] terraform: convert more tests --- terraform/context_test.go | 58 +++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/terraform/context_test.go b/terraform/context_test.go index 7cab27d48..9ebe5766b 100644 --- a/terraform/context_test.go +++ b/terraform/context_test.go @@ -268,6 +268,35 @@ func TestContext2Validate_provisionerConfig_bad(t *testing.T) { } } +func TestContext2Validate_provisionerConfig_good(t *testing.T) { + m := testModule(t, "validate-bad-prov-conf") + p := testProvider("aws") + pr := testProvisioner() + pr.ValidateFn = func(c *ResourceConfig) ([]string, []error) { + if c == nil { + t.Fatalf("missing resource config for provisioner") + } + return nil, nil + } + c := testContext2(t, &ContextOpts{ + Module: m, + Providers: map[string]ResourceProviderFactory{ + "aws": testProviderFuncFixed(p), + }, + Provisioners: map[string]ResourceProvisionerFactory{ + "shell": testProvisionerFuncFixed(pr), + }, + }) + + w, e := c.Validate() + if len(w) > 0 { + t.Fatalf("bad: %#v", w) + } + if len(e) > 0 { + t.Fatalf("bad: %#v", e) + } +} + func TestContext2Validate_requiredVar(t *testing.T) { m := testModule(t, "validate-required-var") p := testProvider("aws") @@ -537,35 +566,6 @@ func TestContextValidate_tainted(t *testing.T) { } } -func TestContextValidate_provisionerConfig_good(t *testing.T) { - m := testModule(t, "validate-bad-prov-conf") - p := testProvider("aws") - pr := testProvisioner() - pr.ValidateFn = func(c *ResourceConfig) ([]string, []error) { - if c == nil { - t.Fatalf("missing resource config for provisioner") - } - return nil, nil - } - c := testContext(t, &ContextOpts{ - Module: m, - Providers: map[string]ResourceProviderFactory{ - "aws": testProviderFuncFixed(p), - }, - Provisioners: map[string]ResourceProvisionerFactory{ - "shell": testProvisionerFuncFixed(pr), - }, - }) - - w, e := c.Validate() - if len(w) > 0 { - t.Fatalf("bad: %#v", w) - } - if len(e) > 0 { - t.Fatalf("bad: %#v", e) - } -} - func TestContextInput(t *testing.T) { input := new(MockUIInput) m := testModule(t, "input-vars")