Merge pull request #5084 from hashicorp/phinze/acctest-nonemptyplan-log

acctests: log a line w/ the non-empty plan
This commit is contained in:
Paul Hinze 2016-02-29 12:35:14 -06:00
commit c5709ce913
1 changed files with 15 additions and 6 deletions

View File

@ -281,10 +281,14 @@ func testStep(
if p, err = ctx.Plan(); err != nil {
return state, fmt.Errorf("Error on follow-up plan: %s", err)
}
if p.Diff != nil && !p.Diff.Empty() && !step.ExpectNonEmptyPlan {
if p.Diff != nil && !p.Diff.Empty() {
if step.ExpectNonEmptyPlan {
log.Printf("[INFO] Got non-empty plan, as expected:\n\n%s", p)
} else {
return state, fmt.Errorf(
"After applying this step, the plan was not empty:\n\n%s", p)
}
}
// And another after a Refresh.
state, err = ctx.Refresh()
@ -295,9 +299,14 @@ func testStep(
if p, err = ctx.Plan(); err != nil {
return state, fmt.Errorf("Error on second follow-up plan: %s", err)
}
if p.Diff != nil && !p.Diff.Empty() && !step.ExpectNonEmptyPlan {
if p.Diff != nil && !p.Diff.Empty() {
if step.ExpectNonEmptyPlan {
log.Printf("[INFO] Got non-empty plan, as expected:\n\n%s", p)
} else {
return state, fmt.Errorf(
"After applying this step and refreshing, the plan was not empty:\n\n%s", p)
"After applying this step and refreshing, "+
"the plan was not empty:\n\n%s", p)
}
}
// Made it here, but expected a non-empty plan, fail!