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:
parent
dbf6d1bd00
commit
88744d569f
|
@ -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
|
// ComposeTestCheckFunc lets you compose multiple TestCheckFuncs into
|
||||||
|
|
|
@ -165,7 +165,10 @@ func TestTest_stepError(t *testing.T) {
|
||||||
if !mt.failed() {
|
if !mt.failed() {
|
||||||
t.Fatal("test should've 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 {
|
if !checkDestroy {
|
||||||
t.Fatal("didn't call check for destroy")
|
t.Fatal("didn't call check for destroy")
|
||||||
|
|
Loading…
Reference in New Issue