Merge pull request #1443 from hashicorp/f-acc-tests-check-empty-plan

providers: check for empty plan after each test step
This commit is contained in:
Mitchell Hashimoto 2015-04-14 08:30:11 -07:00
commit 968a152df4
2 changed files with 12 additions and 0 deletions

View File

@ -230,6 +230,16 @@ func testStep(
}
}
// Verify that Plan is now empty and we don't have a perpetual diff issue
if p, err := ctx.Plan(); err != nil {
return state, fmt.Errorf("Error on follow-up plan: %s", err)
} else {
if p.Diff != nil && !p.Diff.Empty() {
return state, fmt.Errorf(
"After applying this step, the plan was not empty:\n\n%s", p)
}
}
return state, err
}

View File

@ -18,6 +18,8 @@ func init() {
func TestTest(t *testing.T) {
mp := testProvider()
mp.DiffReturn = nil
mp.ApplyReturn = &terraform.InstanceState{
ID: "foo",
}