helper/resource/testing: unit tests to cover #1770

Also clarified that final return value of testStep is now only for the
happy path.
This commit is contained in:
Paul Hinze 2015-05-01 11:22:06 -05:00
parent dbf6d1bd00
commit 88744d569f
2 changed files with 6 additions and 2 deletions

View File

@ -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

View File

@ -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")