From 88744d569f298e69cf84e7e6da540b3920186d25 Mon Sep 17 00:00:00 2001 From: Paul Hinze Date: Fri, 1 May 2015 11:22:06 -0500 Subject: [PATCH] helper/resource/testing: unit tests to cover #1770 Also clarified that final return value of testStep is now only for the happy path. --- helper/resource/testing.go | 3 ++- helper/resource/testing_test.go | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/helper/resource/testing.go b/helper/resource/testing.go index e1156422e..43bee4ce4 100644 --- a/helper/resource/testing.go +++ b/helper/resource/testing.go @@ -266,7 +266,8 @@ func testStep( } } - return state, err + // Made it here? Good job test step! + return state, nil } // ComposeTestCheckFunc lets you compose multiple TestCheckFuncs into diff --git a/helper/resource/testing_test.go b/helper/resource/testing_test.go index a6c944eac..9d42ab634 100644 --- a/helper/resource/testing_test.go +++ b/helper/resource/testing_test.go @@ -165,7 +165,10 @@ func TestTest_stepError(t *testing.T) { if !mt.failed() { t.Fatal("test should've failed") } - t.Logf("Fail message: %s", mt.failMessage()) + expected := "Step 0 error: Check failed: error" + if mt.failMessage() != expected { + t.Fatalf("Expected message: %s\n\ngot:\n\n%s", expected, mt.failMessage()) + } if !checkDestroy { t.Fatal("didn't call check for destroy")