From bc146d21a32dba995203be3f33a93f45000e90d8 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 10 Jul 2014 11:31:07 -0700 Subject: [PATCH] helper/resource: persist state, log --- helper/resource/testing.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/helper/resource/testing.go b/helper/resource/testing.go index c28870e82a..0797248391 100644 --- a/helper/resource/testing.go +++ b/helper/resource/testing.go @@ -4,6 +4,7 @@ import ( "fmt" "io" "io/ioutil" + "log" "os" "strings" "testing" @@ -101,6 +102,7 @@ func Test(t TestT, c TestCase) { // Go through each step and run it for i, step := range c.Steps { var err error + log.Printf("[WARN] Test: Executing step %d", i) state, err = testStep(opts, state, step) if err != nil { t.Error(fmt.Sprintf( @@ -117,6 +119,7 @@ func Test(t TestT, c TestCase) { Destroy: true, } + log.Printf("[WARN] Test: Executing destroy step") state, err := testStep(opts, state, destroyStep) if err != nil { t.Error(fmt.Sprintf( @@ -126,6 +129,8 @@ func Test(t TestT, c TestCase) { err, state)) } + } else { + log.Printf("[WARN] Skipping destroy test since there is no state.") } } @@ -166,6 +171,7 @@ func testStep( // Build the context opts.Config = config + opts.State = state ctx := terraform.NewContext(&opts) if ws, es := ctx.Validate(); len(ws) > 0 || len(es) > 0 { return state, fmt.Errorf(