Skip to content

Commit fb06282

Browse files
paddycarverPaddy
authored andcommitted
Restore pre-binary testing ExpectNonEmptyPlan behavior.
TestSteps do a number of things: first they apply a config, then they run some checks on that config, then they do a plan _without_ refreshing, then refresh, then do _another_ plan. When you tell a TestStep you expect a non-empty plan, _right now_ it expects _both_ those plans to come back empty. Pre-binary testing, however, it only required the second one to come back non-empty. This matters because some providers overload TestChecks to modify resources out of band. When this is done, there's a plan without a refresh (that won't see the modifications) and a plan after a refresh (that will see the changes). If both are forced to agree on whether the plan should be empty or not, you can't use that pattern anymore, because they can't _both_ be right. This restores the original behavior of allowing the first plan to be non-empty _or_ empty when ExpectNonEmptyPlan is set to true (it must be empty when ExpectNonEmptyPlan is false), but requiring the second plan, after the refresh, to be non-empty when ExpectNonEmptyPlan is true.
1 parent 8c571ee commit fb06282

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

helper/resource/testing_new_config.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,6 @@ func testStepNewConfig(t testing.T, c TestCase, wd *tftest.WorkingDir, step Test
141141
return fmt.Errorf("Error retrieving formatted plan output: %w", err)
142142
}
143143
return fmt.Errorf("After applying this test step, the plan was not empty.\nstdout:\n\n%s", stdout)
144-
} else if step.ExpectNonEmptyPlan && planIsEmpty(plan) {
145-
return fmt.Errorf("Expected a non-empty plan, but got an empty plan!")
146144
}
147145

148146
// do a refresh

0 commit comments

Comments
 (0)